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

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.

  1. Log on to the ASM console.
  2. In the left-side navigation pane, choose Service Mesh > Mesh Management.
  3. 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.
  4. On the details page of the ASM instance, choose ASM Instance > Global Namespace in the left-side navigation pane.
  5. 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.
  6. In the Submit message, click OK.

Create an application that runs in an ECI pod

Note After an application is created and run in an ECI pod, ASM can manage the application on the data plane by using sidecars.

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.

  1. 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
  2. Run the following command to create an NGINX application:
    kubectl run nginx -n default --image nginx -l alibabacloud.com/eci=true
  3. 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.

  1. 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
  2. Run the following command to add a label to the vk namespace:
    kubectl label namespace vk alibabacloud.com/eci=true
  3. Run the following command to create an NGINX application:
    kubectl -n vk run nginx --image nginx
  4. 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