adding master to Kubernetes cluster: cluster doesn't have a stable controlPlaneEndpoint address

4/26/2019

How can I add a second master to the control plane of an existing Kubernetes 1.14 cluster? The available documentation apparently assumes that both masters (in stacked control plane and etcd nodes) are created at the same time. I have created my first master already a while ago with kubeadm init --pod-network-cidr=10.244.0.0/16, so I don't have a kubeadm-config.yaml as referred to by this documentation.

I have tried the following instead:

kubeadm join ... --token ... --discovery-token-ca-cert-hash ... \
  --experimental-control-plane --certificate-key ...

The part kubeadm join ... --token ... --discovery-token-ca-cert-hash ... is what is suggested when running kubeadm token create --print-join-command on the first master; it normally serves for adding another worker. --experimental-control-plane is for adding another master instead. The key in --certificate-key ... is as suggested by running kubeadm init phase upload-certs --experimental-upload-certs on the first master.

I receive the following errors:

[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. 
The recommended driver is "systemd". Please follow the guide at 
https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
error execution phase preflight: 
One or more conditions for hosting a new control plane instance is not satisfied.

unable to add a new control plane instance a cluster that doesn't have a stable
controlPlaneEndpoint address

Please ensure that:
* The cluster has a stable controlPlaneEndpoint address.
* The certificates that must be shared among control plane instances are provided.

What does it mean for my cluster not to have a stable controlPlaneEndpoint address? Could this be related to controlPlaneEndpoint in the output from kubectl -n kube-system get configmap kubeadm-config -o yaml currently being an empty string? How can I overcome this situation?

-- rookie099
kubeadm
kubernetes

2 Answers

4/26/2019

You need to copy the certificates ( etcd/api server/ca etc. ) from the existing master and place on the second master. then run kubeadm init script. since the certs are already present the cert creation step is skipped and rest of the cluster initialization steps are resumed.

-- P Ekambaram
Source: StackOverflow

4/26/2019

As per HA - Create load balancer for kube-apiserver:

  • In a cloud environment you should place your control plane nodes behind a TCP forwarding load balancer. This load balancer distributes traffic to all healthy control plane nodes in its target list. The health check for an apiserver is a TCP check on the port the
    kube-apiserver listens on (default value :6443).
  • The load balancer must be able to communicate with all control plane nodes on the apiserver port. It must also allow incoming traffic on its listening port.
  • Make sure the address of the load balancer always matches the address of kubeadm’s ControlPlaneEndpoint.

To set ControlPlaneEndpoint config, you should use kubeadm with the --config flag. Take a look here for a config file example:

apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: stable
controlPlaneEndpoint: "LOAD_BALANCER_DNS:LOAD_BALANCER_PORT"

Kubeadm config files examples are scattered across many documentation sections. I recommend that you read the /apis/kubeadm/v1beta1 GoDoc, which have fully populated examples of YAML files used by multiple kubeadm configuration types.


If you are configuring a self-hosted control-plane, consider using the kubeadm alpha selfhosting feature:

[..] key components such as the API server, controller manager, and scheduler run as DaemonSet pods configured via the Kubernetes API instead of static pods configured in the kubelet via static files.

This PR (#59371) may clarify the differences of using a self-hosted config.

-- Eduardo Baitello
Source: StackOverflow