By Xiaobing Meng (Zhishi)
As enterprises further deepen their digital transformation, the flexibility and scalability of infrastructure have become a key challenge. Traditional data centers are limited by physical capacity, making it difficult to achieve dynamic scaling, thus lacking the necessary scalability. In this case, cloud elasticity provided by ACK One registered clusters is the best solution to address this issue due to its high flexibility and rich resource options.
Self-managed Kubernetes clusters in traditional data centers have limited capacity and insufficient elasticity. By connecting the self-managed Kubernetes cluster in the data center to the ACK One registered cluster for unified management, these limitations can be effectively overcome, bringing the following benefits:
• Resource auto scaling: Through integration with Alibaba Cloud resources, computing resources can be scaled out on demand, improving resource utilization and reducing costs.
• Cost optimization: Alibaba Cloud's pay-as-you-go billing method avoids the sunk costs of fixed investments in the data center and charges based on actual usage, which is more cost-effective.
The preceding figure shows the overall architecture of the ACK One registered cluster. Currently, you can quickly connect a Kubernetes cluster in the data center to a registered cluster through the following steps:
kubectl -n kube-system get pod |grep ack-cluster-agent
Expected output:
ack-cluster-agent-5f7d568f6-6fc4k 1/1 Running 0 9s
ack-cluster-agent-5f7d568f6-tf6fp 1/1 Running 0 9s
Cloud elasticity provided by ACK One registered clusters helps enterprises solve the preceding challenges with its powerful features and flexible resource selection.
1. Rich elastic resource options:
2. Highly flexible scalability:
You can use ACK One registered clusters for centralized management and rapid construction of a hybrid cloud environment. When computing resources in data centers cannot meet your business requirements, you can create a node pool to scale out computing resources in the cloud.
The node pool of ACK One registered clusters provides the following benefits:
Next, we will perform the following steps to create and use a cloud node pool.
1. Prepare a custom script. Since GPU models are likely to be used in actual business scenarios, you can add the following script to the custom script to detect GPU models and install the corresponding drivers based on the detection results. For more information about GPU drivers, please refer to Install the new NVIDIA driver version on the node.
#!/bin/bash
# Check whether Ispci is installed.
if ! which lspci &>/dev/null; then
yum -y install pciutils
fi
# Check whether the node is equipped with a GPU.
if lspci | grep -i nvidia &>/dev/null; then
echo "Install the relevant drivers because the node is a GPU-accelerated node."
fi
Custom scripts vary based on the deployment methods of Kubernetes clusters in the data center. For more information about custom scripts, please refer to Create a node pool in a registered cluster.
2. To facilitate subsequent scheduling, you can receive system environment variables from registered clusters in custom scripts. For more information about how to add an environment for a custom script, please refer to Create a node pool in a registered cluster.
3. Save and configure the script definition to the registered cluster configuration items.
4. Create and scale out a node pool.
5. Run the following command to view the scale-out result.
kubectl get no
Expected output: Nodes in the <RegionID>
.<IP>
format are ECS nodes that are scaled out by using a node pool.
NAME STATUS ROLES AGE VERSION
cn-***.192.168.XX.XXX Ready <none> 5h43m v1.28.2
idc-worker-001 Ready <none> 5h51m v1.28.2
idc-worker-002 Ready <none> 5h54m v1.28.2
master-0906-001 Ready control-plane 4d3h v1.28.2
6. Run the following command to create a pod in the node pool of the registered cluster.
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx-deployment-cloud
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
nodeSelector:
alibabacloud.com/nodepool-id: np6d13af2bb56546128*** # This is the ID of the node pool of the registered cluster.
containers:
- image: 'registry.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2'
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
cpu: 500m
EOF
You can schedule pods to elastic container instances that are deployed as virtual nodes. This way, you do not need to purchase or manage ECS instances, so as to efficiently use resources.
Next, we will perform the following steps to deploy ack-virtual-node and schedule pods to ECI:
1. Install the ack-virtual-node component through registered cluster operation and maintenance or the command-line tool. For more information about components, please refer to Schedule pods to elastic container instances that are deployed as virtual nodes.
2. Run the following command to view the deployment status of the virtual node.
kubectl get no
Expected output: Nodes in the virtual-kubelet- format are virtual nodes.
NAME STATUS ROLES AGE VERSION
idc-worker-001 Ready <none> 6h21m v1.28.2
idc-worker-002 Ready <none> 6h24m v1.28.2
master-0906-001 Ready control-plane 4d3h v1.28.2
virtual-kubelet-cn-*** Ready agent 4d v1.28.2
3. Run the following command to schedule pods to ECI by using the specified label alibabacloud.com/eci=true.
kubectl run nginx --image=registry.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2 -l alibabacloud.com/eci=true
By combining ack-co-scheduler components with cloud node pools and ECIs, multilevel resource scheduling is implemented. The resources in the data center are preferentially used, then the cloud node pools, and finally the resources of ECIs, ensuring the rational allocation and efficient use of resources.
a) Run the following command to create a scheduling policy. If resources in the data center are insufficient, business is scheduled to the node pool of the registered cluster.
kubectl apply -f - <<EOF
apiVersion: scheduling.alibabacloud.com/v1alpha1
kind: ResourcePolicy
metadata:
name: schedued-to-node-pool
spec:
selector:
app: nginx
strategy: prefer
units:
- resource: idc
- resource: ecs
nodeSelector:
alibabacloud.com/nodepool-id: np6d13af2bb** # This is the ID of the cloud node pool. If resources in the data center are insufficient, business is scheduled to the cloud node pool.
EOF
b) Run the following command to create a scheduling policy. If resources in the data center are insufficient, business is scheduled to the ECI.
kubectl apply -f - <<EOF
apiVersion: scheduling.alibabacloud.com/v1alpha1
kind: ResourcePolicy
metadata:
name: schedued-to-eci
spec:
selector:
app: nginx
strategy: prefer
units:
- resource: idc
- resource: eci # When the resources in the data center are insufficient, business is scheduled to ECI.
EOF
The cloud node pool provided by ACK One registered clusters offers enterprises unprecedented flexibility and scalability due to its rich elastic resource options and simple operation procedures. Alibaba Cloud can quickly respond to business requirements for general computing, container instances, and high-performance computing tasks, thereby helping enterprises move towards digital transformation more efficiently.
Visit the ACK One official website now to learn more details and start your intelligent expansion journey!
Batch System: Batch Compute and Cloud-native Serverless Argo Workflows
Argo Workflows 3.6: Key New Features in Cloud-native Orchestration
175 posts | 31 followers
FollowAlibaba Container Service - October 30, 2024
Alibaba Container Service - November 21, 2024
Alibaba Cloud Native - October 18, 2023
Alibaba Cloud Native - October 16, 2023
Alibaba Cloud Native - October 18, 2023
Alibaba Container Service - April 18, 2024
175 posts | 31 followers
FollowAlibaba Cloud Container Service for Kubernetes is a fully managed cloud container management service that supports native Kubernetes and integrates with other Alibaba Cloud products.
Learn MoreProvides a control plane to allow users to manage Kubernetes clusters that run based on different infrastructure resources
Learn MoreAccelerate and secure the development, deployment, and management of containerized applications cost-effectively.
Learn MoreA secure image hosting platform providing containerized image lifecycle management
Learn MoreMore Posts by Alibaba Container Service