Container Compute Service (ACS) is integrated into Distributed Cloud Container Platform for Kubernetes (ACK One) registered clusters. You can use ACK One registered clusters to quickly use the computing power provided by ACS. This topic describes how to use the computing power of ACS in registered clusters of ACK One.
How to use the computing power of ACS in ACK One registered clusters
Container Compute Service (ACS) is a cloud computing service that provides container compute resources that comply with the container specifications of Kubernetes. ACS adopts a layered architecture to implement Kubernetes control and computing power. The compute resources layer schedules and allocates resources to pods. The Kubernetes control layer manages workloads, such as Deployments, Services, StatefulSets, and CronJobs.
The computing power of ACS can be implemented in Kubernetes clusters by using virtual nodes. This way, Kubernetes clusters are empowered with high elasticity and are no longer limited by the computing capacity of cluster nodes. After you use ACS to take over infrastructure management for pods, the Kubernetes cluster no longer needs to schedule or launch individual pods. In addition, the Kubernetes cluster no longer needs to be concerned about the resources of underlying VMs. ACS can meet the resource requirements of pods at any time.
In ACK One registered clusters, you must install the ack-virtual-node component to deploy virtual nodes and create ACS pods. If you need to scale out your cluster, you can create ACS pods on virtual nodes without the need to plan the resource capacities of the nodes. ACS pods can communicate with pods on physical nodes in the cluster. To efficiently use resources, shorten the scaling time, and reduce costs, we recommend that you schedule specific workloads that run for an extended period of time and have elastic traffic to virtual nodes. As the number of business traffic decreases, the pods on the virtual node can be quickly released to reduce usage costs. Pods on virtual nodes run in a secure and isolated environment that is built on top of ACS. In this case, a pod is referred to as an ACS pod. For more information, see Overview of registered clusters.
Prerequisites
An ACK One registered cluster is created and connected to a data center or a Kubernetes cluster of another cloud service provider (Kubernetes 1.24 or later is recommended).
The ACK virtual node component is installed and the version of the component is 2.13.0 or later. For more information, see Grant RAM permissions to ack-virtual-node and Install ack-virtual-node.
How to use the CPU computing power of ACS in ACK One registered clusters
After you install the required version of ACK Virtual Node or update the component to version 2.13.0 or later, you can create ACS pods and elastic container instances.
When you schedule pods to virtual nodes, if you do not specify the compute class of the pods, elastic container instances are prioritized for pod scheduling by default.
To use the computing power of ACS in an ACK cluster, perform the following steps:
Create a file named nginx.yaml that contains the following content:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx labels: app: nginx spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx alibabacloud.com/acs: "true" # Use the computing power of ACS. alibabacloud.com/compute-class: general-purpose # The compute class of the ACS pod. alibabacloud.com/compute-qos: default # The QoS class of the ACS pod. spec: containers: - name: nginx image: mirrors-ssl.aliyuncs.com/nginx:stable-alpine ports: - containerPort: 80 protocol: TCP resources: limits: cpu: 2 requests: cpu: 2Run the following command to create an NGINX application:
kubectl apply -f nginx.yamlRun the following command to check whether the NGINX application is deployed:
kubectl get pods -o wideExpected output:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-54bcbc9b66-**** 1/1 Running 0 3m29s 192.168.XX.XXX virtual-kubelet-cn-shanghai-l <none> <none> nginx-54bcbc9b66-**** 1/1 Running 0 3m29s 192.168.XX.XXX virtual-kubelet-cn-shanghai-l <none> <none>The command output indicates that the two pods are deployed on nodes that have the
type=virtual-kubeletlabel, which is specified by thenodeSelectorparameter in the Deployment configurations.Run the following command to query the details of the pod created for the NGINX application:
kubectl describe pod nginx-54bcbc9b66-****Expected output:
Annotations: ProviderCreate: done alibabacloud.com/instance-id: acs-uf6008giwgjxlvn***** alibabacloud.com/pod-ephemeral-storage: 30Gi alibabacloud.com/pod-use-spec: 2-2Gi kubernetes.io/pod-stream-port: 10250 network.alibabacloud.com/enable-dns-cache: false topology.kubernetes.io/region: cn-shanghaiThe command output indicates that the configurations of the pod include the
alibabacloud.com/instance-id: acs-uf6008giwgjxlvn*****annotation. This indicates that the pod is an ACS pod.
How to use the GPU computing power of ACS in ACK One registered clusters
The procedure for using ACS GPU compute power is similar to that for using ACS CPU compute power. However, you also need to ensure that the scheduling components meet the version requirements and add some additional configurations.
Activation
The feature of using ACS GPU computing power in ACK clusters is in invitational preview. To use this feature, submit a ticket.
How to use the computing power of ACS in registered clusters of ACK One
...
labels:
# Add labels to request ACS GPU resources.
alibabacloud.com/compute-class: gpu #Set to gpu if GPU compute power is used.
alibabacloud.com/compute-qos: default #The QoS class, which is the same as regular ACS compute power.
alibabacloud.com/gpu-model-series: example-model # The GPU model. Specify the actual model that you use, such as T4.
...For more information about the relationship between ACS compute classes and QoS classes, see Mappings between compute classes and computing power QoS classes.
For more information about the GPU models supported by
gpu-model-series, see Specify GPU models and driver versions for ACS GPU-accelerated pods.
Use the following content to create a GPU workload:
apiVersion: apps/v1 kind: Deployment metadata: name: dep-node-selector-demo labels: app: node-selector-demo spec: replicas: 1 selector: matchLabels: app: node-selector-demo template: metadata: labels: app: node-selector-demo # The ACS attributes. alibabacloud.com/acs: "true" # Use the computing power of ACS. alibabacloud.com/compute-class: gpu alibabacloud.com/compute-qos: default alibabacloud.com/gpu-model-series: example-model # The GPU model. Specify the actual model that you want to use, such as T4. spec: containers: - name: node-selector-demo image: registry-cn-hangzhou.ack.aliyuncs.com/acs/stress:v1.0.4 command: - "sleep" - "1000h" resources: limits: cpu: 1 memory: 1Gi nvidia.com/gpu: "1" requests: cpu: 1 memory: 1Gi nvidia.com/gpu: "1"Run the following command to query the status of the GPU-accelerated workload:
kubectl get pod node-selector-demo-9cdf7bbf9-s**** -oyamlExpected output:
phase: Running resources: limits: #other resources nvidia.com/gpu: "1" requests: #other resources nvidia.com/gpu: "1"