Container Compute Service (ACS) lets you run Knative Service pods on ACS computing power, which provides diverse compute types and quality levels to meet different workload demands and help you optimize costs. You pay only for the CPU and memory each pod consumes.
To use ECI computing power instead of ACS, see Use ECI resources.
How it works
When a pod is scheduled to an ACK Virtual Node, the Virtual Node can provision it on either ACS or ECI. Adding the label alibabacloud.com/acs: "true" to the pod template tells the Virtual Node to use ACS as the underlying compute. Two optional labels let you control the compute type and compute quality of the ACS instance.
Billing
ACS CPU computing resources are billed on a pay-as-you-go basis. For details, see Billing.
Prerequisites
Before you begin, ensure that you have:
-
Knative deployed in the cluster. For details, see Deploy and manage Knative components.
-
ACK Virtual Node version 2.13.0 or later installed. To upgrade, see Components.
-
Container Compute Service activated. For details, see Activate Container Compute Service for the first time.
Configure a Knative Service to use ACS
-
Create a YAML file for your Knative Service. Add the required label and any optional labels to
spec.template.metadata.labels. The following labels control ACS scheduling: Exampleservice.yaml:Label Required Default Description alibabacloud.com/acsRequired — Set to "true"to run the pod on ACS computing poweralibabacloud.com/compute-classOptional general-purposeSpecifies the compute type alibabacloud.com/compute-qosOptional defaultSpecifies the compute quality apiVersion: serving.knative.dev/v1 kind: Service metadata: name: knative-acs-sample namespace: default spec: template: metadata: labels: # Required: run this pod on ACS computing power alibabacloud.com/acs: "true" # Optional: compute type (default: general-purpose) alibabacloud.com/compute-class: "general-purpose" # Optional: compute quality (default: default) alibabacloud.com/compute-qos: "default" spec: containers: - image: registry-vpc.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go:73fbdd56 # Replace with the image in your region name: acs-container imagePullPolicy: IfNotPresent -
Deploy the Knative Service.
kubectl apply -f service.yaml -
Verify that the pod is running on ACS.
# Get the pod name POD_NAME=$(kubectl get pod -l serving.knative.dev/service=knative-acs-sample -o jsonpath='{.items[0].metadata.name}') # View pod annotations kubectl get pod $POD_NAME -o yamlIn the output, check the
alibabacloud.com/instance-idannotation underannotations. A value starting withacs-confirms the pod is running on ACS. Other annotation fields can be ignored.annotations: alibabacloud.com/cpu-vendors: intel alibabacloud.com/instance-id: acs-uf6008givz7tfq****** # Starts with "acs-" — pod is on ACS alibabacloud.com/pod-use-spec: 0.25-0.5Gi ...
What's next
-
Use ECI resources — switch to ECI computing power for Knative Services
-
Compute type and compute quality — explore all available ACS compute options