Container Service provides various serverless containers based on virtual nodes and Elastic Container Instance (ECI). For example, virtual nodes can be deployed in Container Service for Kubernetes (ACK) clusters to enable seamless integration of Kubernetes and ECI. You can create ECI pods as needed to avoid the planning of cluster capacity. This topic describes how to use Alibaba Cloud Service Mesh (ASM) to manage applications in ECI pods that run on the virtual nodes of ACK clusters.
Prerequisites
- The version of your ASM instance is v1.7.5.41-ge61a01c3-aliyun or later.
- The ack-virtual-node component is deployed and properly runs in your ACK cluster. For more information, see Step 1: Deploy ack-virtual-node in ACK clusters.
- The ACK cluster is added to your ASM instance. For more information, see Add a cluster to an ASM instance.
Enable automatic sidecar injection
After you enable automatic sidecar injection for a namespace in the ASM console, an Envoy proxy is automatically injected as a sidecar into each pod that is created in the namespace. These Envoy proxies comprise the data plane of the ASM instance.
- Log on to the ASM console.
- In the left-side navigation pane, choose .
- On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
- On the details page of the ASM instance, choose in the left-side navigation pane.
- On the Global Namespaces page, find the namespace for which you want to enable automatic sidecar injection and click Enable Automatic Sidecar Injection in the Automatic Sidecar Injection column. In this example, automatic sidecar injection is enabled for the namespaces that are named default and vk. If no namespaces are available, you must create at least two namespaces.
- In the Submit message, click OK.
Create an application that runs in an ECI pod
Use a pod label to create an application that runs in an ECI pod
You can add the label alibabacloud.com/eci=true
label to a pod to make the pod an ECI pod that runs on a virtual node.
- Run the following command to check whether the
istio-injection=enabled
label is added to the namespace that is named default:kubectl get ns default --show-labels
The following output is expected:
NAME STATUS AGE LABELS default Active 84d istio-injection=enabled,provider=asm
- Run the following command to create an NGINX application:
kubectl run nginx -n default --image nginx -l alibabacloud.com/eci=true
- Run the following command to view the information about the pods that run on virtual nodes:
kubectl get pod -n default -o wide|grep virtual-kubelet
Use a namespace label to create an application that runs in an ECI pod
You can add the label alibabacloud.com/eci=true
label to the namespace of a pod to make the pod an ECI pod that runs on a virtual node.
- Run the following command to check whether the
istio-injection=enabled
label is added to the vk namespace:kubectl get ns default --show-labels
The following output is expected:
NAME STATUS AGE LABELS default Active 84d istio-injection=enabled,provider=asm
- Run the following command to add a label to the vk namespace:
kubectl label namespace vk alibabacloud.com/eci=true
- Run the following command to create an NGINX application:
kubectl -n vk run nginx --image nginx
- Run the following command to view the information about the pods that run on virtual nodes:
kubectl -n vk get pod -o wide|grep virtual-kubelet