This topic describes the frequently asked questions about network management.

How do can I rename SLB instances if the Cloud Controller Manager (CCM) version is V1.9.3.10 or earlier?

For CCM 1.9.3.10 and earlier, you must manually add tags to Server Load Balancer (SLB) instances. For CCM versions later than V1.9.3.10, tags are automatically attached to SLB instances in the cluster. This way, you can rename SLB instances. Perform the following steps:
Note
  • You can rename SLB instances by adding tags to the instances only if the CCM version is V1.9.3.10 or earlier.
  • The service type is LoadBalancer
  1. Log on to a master node in an Alibaba Cloud Container Service for Kubernetes (ACK) cluster. For more information, see Connect to Kubernetes clusters through kubectl.
  2. Run the # kubectl get svc -n ${namespace} ${service} command to view the service type and service IP address.Service type
    Note Replace ${namespace} and ${service} with the cluster namespace and service name.
  3. Run the following command to generate a tag for the SLB instance.
    # kubectl get svc -n ${namespace} ${service} -o jsonpath="{.metadata.uid}"|awk -F "-" '{print "kubernetes.do.not.delete: "substr("a"$1$2$3$4$5,1,32)}'
    tag
  4. Log on to the Server Load Balancer console, select the region where the SLB instance is deployed, and use the IP address that is returned in Step 2 to find the target SLB instance.
  5. Add the tag that is generated in Step 3 to the SLB instance. Callout 1 in the preceding figure shows the tag key, and callout 2 shows the tag value. For more information, see Add a tag.

Which network plug-in should I choose for an ACK cluster, Terway or Flannel?

You can choose Terway or Flannel based on the following information.

ACK provides two network plug-ins when you create an ACK cluster:
  • Flannel: a simple and stable Container Network Interface (CNI) plug-in developed by the Kubernetes community. You can use Flannel with Virtual Private Cloud (VPC) networks of Alibaba Cloud. This enables your clusters and containers to run in a high-speed and stable network. Flannel does not support standard Kubernetes network policies.
  • Terway: a network plug-in developed by Alibaba Cloud Container Service. Terway is fully compatible with Flannel and allows you to assign Alibaba Cloud Elastic Network Interfaces (ENIs) to containers. It also allows you to customize network policies of Kubernetes to control intercommunication among containers, and implement bandwidth throttling on individual containers. If you do not need to use network policies, select Flannel. In other cases, we recommend that you select Terway. For more information about Terway, see Use Terway.

How do I manually install alicloud-application-controller?

For Kubernetes 1.10.4 and later, alicloud-application-controller is automatically installed to enable phased release based on custom resource definitions (CRDs).

Note For the latest Kubernetes version, alicloud-application-controller is automatically installed. For Kubernetes versions later than V1.9.3 and earlier than 1.10.4, you need to manually install alicloud-application-controller.
You can run the kubectl create -f alicloud-application-controller.yml command to install alicloud-application-controller. Copy the following content to the alicloud-application-controller.yml file.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: alicloud-application-controller
  labels:
    owner: aliyun
    app: alicloud-application-controller
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      owner: aliyun
      app: alicloud-application-controller
  template:
    metadata:
      labels:
        owner: aliyun
        app: alicloud-application-controller
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      tolerations:
      - effect: NoSchedule
        operator: Exists
        key: node-role.kubernetes.io/master
      - effect: NoSchedule
        operator: Exists
        key: node.cloudprovider.kubernetes.io/uninitialized
      containers:
        - name: alicloud-application-controller
          image: registry.cn-hangzhou.aliyuncs.com/acs/aliyun-app-lifecycle-manager:0.1-c8d5da8
          imagePullPolicy: IfNotPresent
      serviceAccount: admin

Can I use hostPorts for port mapping in an ACK cluster?

  • No, you cannot use hostPorts for port mapping in an ACK cluster.
  • A pod in a VPC network can be accessed by other cloud resources deployed in the same VPC network by using the endpoint of the pod in the VPC network. Therefore, port mapping is not required.
  • You can make a service accessible over the Internet if the service type is NodePort or LoadBalancer.

How does CCM calculate node weights in Local mode?

Assume that pods with the app=nginx label are deployed on three Elastic Compute Service (ECS) instances. In the following figure, the pods provide services for external users by using Service A when externalTrafficPolicy is set to Local. The node weights are calculated as follows:
Figure 1.
CCM2
  • For CCM 1.9.3.164-g2105d2e-aliyun and later

    Assume that the CCM version is earlier than v1.9.3.164-g2105d2e-aliyun. As shown in the following figure, the weight of each ECS instance in Local mode is 100. This means that traffic loads are evenly distributed to the three ECS instances. However, the loads of the pods are different because the pods are unevenly deployed on the ECS instances. For example, the pod on ECS 1 has the heaviest load and the pods on ECS 3 have the lightest load.

    Figure 2.
    CCM3
  • For CCM version later than V1.9.3.276-g372aa98-aliyun and earlier than V1.9.3.164-g2105d2e-aliyun

    As shown in figure 3, for CCM versions later than V1.9.3.276-g372aa98-aliyun and earlier than V1.9.3.164-g2105d2e-aliyun, the node weights are calculated based on the number of pods deployed on each node. The weights of the three ECS instances are 16, 33, and 50. Therefore, traffic loads are distributed to the three ECS instances at the ratio of 1:3:5.

    Calculation formula:Calculation formula
    Figure 3.
    ccm4
  • For CCM 1.9.3.276-g372aa98-aliyun and later

    The weight calculation in figure 3 still has a slight imbalance due to the precision of the calculation formula. For CCM 1.9.3.276-g372aa98-aliyun and later, the weight of each node equals the number of pods deployed on the node. As shown in figure 4, the weights of the three ECS instances are 1, 2, and 3. Traffic loads are distributed to the three ECS instances at the ratio of 1:2:3. The pods have a more balanced load than those in figure 3.

    Calculation formula:Node weight
    Figure 4.
    node