Container Compute Service (ACS) provides various compute classes and QoS classes to meet diverse business needs. You can use ACS computing power in ACK Serverless Pro clusters. After you upgrade the ACK Virtual Node component to a specified version, you can use a label to specify ACS computing power when you create a pod.
Prerequisites
-
The first time you perform this procedure, you must activate the required services and grant the necessary permissions.
-
Activate Container Service for Kubernetes (ACK), grant the default roles, and activate related cloud services. For more information, see Create a dedicated Kubernetes cluster.
-
Log on to the ACS console and follow the on-screen instructions to activate Container Compute Service (ACS).
-
-
The ACK Serverless cluster must be running Kubernetes 1.26 or later.
-
The required ACK Virtual Node component version depends on the Kubernetes version of your ACK Serverless Pro cluster:
Kubernetes version
Component version
1.26 or later
v2.13.0 or later
Upgrade the ACK Virtual Node component
The ACK Virtual Node component is installed by default in ACK Serverless Pro clusters. Make sure that the component is upgraded to the version specified in the Prerequisites section.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click Components and Add-ons.
-
On the Core Components tab, find the ACK Virtual Node component and upgrade it.
NoteIf you are prompted to activate and authorize Container Compute Service (ACS), follow the instructions to complete the activation and authorization, and then upgrade the component.
In the left-side navigation pane of the cluster, choose O&M > Add-ons. Find the ACK Virtual Node component and confirm that its status is installed and its version is
v2.13.0 or later.
Example: Use ACS computing power
-
Once upgraded to the version specified in the Prerequisites section, the ACK Virtual Node component supports both ACS and Elastic Container Instance (ECI) computing power.
-
When a pod is scheduled to a virtual node, if you do not specify an ACS compute class, the pod uses Elastic Container Instance (ECI) computing power by default.
When you create a pod in an ACK Serverless Pro cluster, you can use ACS computing power by adding the alibabacloud.com/compute-class:<ACS_compute_class> label to specify the pod's compute class. For more information about ACS pod types, see ACS pod instance overview.
-
Save the following YAML content as nginx.yaml to create a Deployment.
apiVersion: apps/v1 kind: Deployment metadata: name: nginx labels: app: nginx spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: name: nginx labels: app: nginx alibabacloud.com/compute-class: general-purpose # Configure the compute class for the ACS pod. Default: general-purpose. alibabacloud.com/compute-qos: default # Configure the QoS class for the ACS pod. Default: default. spec: containers: - name: nginx image: registry.openanolis.cn/openanolis/nginx:1.14.1-8.6 resources: limits: cpu: 2 requests: cpu: 2 -
Create the Deployment and view the result.
-
Create the Deployment.
kubectl apply -f nginx.yamlExpected output:
deployment.apps/nginx created -
View the deployment result.
kubectl get pods -o wideExpected output:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-675c8f56b4-4zczj 1/1 Running 0 25s 192.168.3.220 virtual-kubelet-cn-shanghai-l <none> <none> nginx-675c8f56b4-dgzvz 1/1 Running 0 25s 192.168.3.219 virtual-kubelet-cn-shanghai-l <none> <none>
-
-
View the pod details to confirm that it is an ACS pod.
kubectl describe pod nginx-675c8f56b4-4zczjIn the
Annotationssection of the output, check the value of thealibabacloud.com/instance-idfield to confirm that the pod is an ACS pod. The ID of this ACS pod isacs-uf6008givz7tfq******.Annotations: ProviderCreate: done alibabacloud.com/client-token: dbaa4a4f-4251-402b-b74c-9f762d****** alibabacloud.com/instance-id: acs-uf6008givz7tfq****** alibabacloud.com/pod-ephemeral-storage: 30Gi alibabacloud.com/pod-use-spec: 2-2Gi alibabacloud.com/request-id: 7E1F90D3-D1A4-50F3-867A-313B9F****** alibabacloud.com/schedule-result: finished alibabacloud.com/user-id: 1488999589****** kubernetes.io/pod-stream-port: 10250 kubernetes.io/resource-type: serverless