• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide 2.0
  4. Cluster Management
  5. Configuring kube-dns HA Using kubectl

Configuring kube-dns HA Using kubectl

kube-dns provides the domain name service (DNS) for clusters. If only one kube-dns is deployed in a cluster, the entire cluster will not run properly if the kube-dns fails. Therefore, you are advised to configure kube-dns HA for a cluster.

This section describes how to use kubectl to configure kube-dns HA.

Prerequisites

The cluster is accessible from the Internet, or the cluster and the client are in the same VPC.

Procedure

  1. Log in to the CCE console. In the navigation pane, choose Resource Management > VM Clusters. Click Kubectl for the cluster to which you want to connect.
  2. Set the API access mode for the cluster.
  3. Configure the CLI tool.

    After the CLI tool is successfully configured, you can use it to manually configure kube-dns HA.

  4. Log in to the client.
  5. Edit the deployment configuration file of kube-dns.

    kubectl edit deployment kube-dns -n kube-system

    Change the value of replicas in the spec section in the deployment configuration file to the number of kube-dns instances required.

    Example:

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      annotations:
        deployment.kubernetes.io/revision: "1"
      creationTimestamp: 2018-03-27T13:58:35Z
      enable: true
      generation: 1
      labels:
        addonmanager.kubernetes.io/mode: Reconcile
        k8s-app: kube-dns
        kubernetes.io/cluster-service: "true"
        kubernetes.io/lock: "true"
      name: kube-dns
      namespace: kube-system
      resourceVersion: "211"
      selfLink: /apis/extensions/v1beta1/namespaces/kube-system/deployments/kube-dns
      uid: f168e8c8-31c6-11e8-954c-fa163e673ffd
    spec:
      replicas: 1
      selector:
        matchLabels:
          k8s-app: kube-dns
      strategy:
        rollingUpdate:
          maxSurge: 10%
          maxUnavailable: 0
        type: RollingUpdate
      template:
        ......