Use ACS computing power in ACK Serverless clusters

Updated at:

Container Compute Service (ACS) computing power supports multiple compute classes and matching Quality of Service (QoS) classes for diverse business needs. In ACK Serverless Pro clusters, after you upgrade the ACK Virtual Node add-on to the required version, use a label to specify ACS computing power for a pod.

Prerequisites

  • The first time you perform these steps, you must activate the required services and complete the related authorization.

  • The ACK Serverless Pro cluster runs Kubernetes 1.26 or later.

  • The required version of the virtual node add-on (ACK Virtual Node) depends on the Kubernetes version of your ACK Serverless Pro cluster.

    Kubernetes version

    Virtual node add-on version

    1.26 or later

    v2.13.0 or later

Upgrade the ACK Virtual Node add-on to enable ACS computing power

The ACK Virtual Node add-on is installed by default in ACK Serverless Pro clusters. Make sure that the add-on is upgraded to the version required in Prerequisites.

  1. On the Clusters page, click the name of your cluster. In the left navigation pane, click Components and Add-ons .

  2. In the left navigation pane of the cluster, choose O&M > Components and Add-ons. On the Core Components tab, find ACK Virtual Node and upgrade the add-on.

    If you are prompted to activate and authorize ACS, follow the instructions to complete the activation and authorization, and then upgrade the add-on.

    Confirm that the status of the ACK Virtual Node add-on is Installed and that its version meets the requirement in Prerequisites.

Example: Use ACS computing power in ACK Serverless Pro clusters

Important
  • ACK Virtual Node add-on, once upgraded to the version required in Prerequisites, supports both ACS and Elastic Container Instance (ECI) computing power.

  • When a pod is scheduled to a virtual node, if you do not specify a compute class for the ACS pod, ECI computing power takes precedence by default.

When you create a pod in an ACK Serverless Pro cluster, you can use ACS computing power. Set the alibabacloud.com/compute-class:<ACS_compute_class> label to specify the compute class of the ACS pod. For more information about ACS pod types, see Overview of ACS pods.

  1. 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 # Specifies the compute class of the ACS pod. Default value: general-purpose
            alibabacloud.com/compute-qos: default # Specifies the QoS class of the ACS pod. Default value: default
        spec:
          containers:
          - name: nginx
            image: registry.openanolis.cn/openanolis/nginx:1.14.1-8.6
            resources:
              limits:
                cpu: 2
              requests:
                cpu: 2
  2. Create the Deployment and view the deployment result.

    1. Create the Deployment.

      kubectl apply -f nginx.yaml 

      Expected output:

      deployment.apps/nginx created
    2. View the deployment result.

      kubectl get pods -o wide

      Expected 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>
  3. View the pod details to confirm that the pod is an ACS pod.

    kubectl describe pod nginx-675c8f56b4-4zczj 

    In the Annotations section of the output, the value of the alibabacloud.com/instance-id field confirms that the pod is an ACS pod. The ID of this ACS pod is acs-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

The pods that this example creates use ACS computing power, which is billed on a pay-as-you-go basis. To stop the charges after you verify the result, delete the Deployment: kubectl delete -f nginx.yaml. For more information, see Billing overview.