Kubernetes Views 5

Building a Kubernetes HA cluster, part 2

Building a Kubernetes HA cluster, part 2 image 1

Building an HA cluster, part 2


Building a Kubernetes HA cluster, part 2 image 2

In part 1 we set up the load balancer.

Every node is now in place, so let’s move on to creating the cluster.

Cluster Initializing


On a single-master node you can point Kubernetes API clients at the master itself as the endpoint and talk to the workers that way.
In a high-availability cluster, though, workers cannot look at multiple API servers at once, so the load balancer acts as a gateway of sorts for the API servers.

When you first build a Kubernetes cluster you can include the options on the command line, but this time we will create a kubeadm-config.yaml and build from that.

  • kubeadm-config.yaml
  • apiVersion: kubeadm.k8s.io/v1beta3 
    kind: InitConfiguration 
    localAPIEndpoint: 
    advertiseAddress: "10.10.10.1" # IP of the first init node; any of masters 1, 2, or 3 is fine 
    bindPort: 6443 
    ---
    apiVersion: kubeadm.k8s.io/v1beta3 
    kind: ClusterConfiguration 
    kubernetesVersion: stable 
    controlPlaneEndpoint: "10.10.10.254" #Load Balancer IP 
    networking: 
    podSubnet: "10.244.0.0/16"

After creating the file above, create the cluster.

 kubeadm init --upload-certs --config kubeadm-config.yaml

Cluster Join


When you first create the cluster, two kubeadm join ~ commands are printed.
The first command printed is the one that joins a master.
The second command printed is the one that joins a worker.

If you lose the join commands, you can generate them again.

  • Master node

     kubeadm init phase upload-certs --upload-certs | tail -1 # copy the value this command produces 
     kubeadm token create --print-join-command --certificate-key # paste it after this

On a master node you can build a join command by combining those two commands.

  • Worker node

     kubeadm token create --print-join-command

Part 3

https://librat.kr/entry/Kubernetes-HA-Cluster-고가용성-클러스터-구축-3

Reactions

Comments 0

A nickname and a password are required. The same password edits or deletes the comment later. Comments appear after a review.

Comments appear after a review. The password is used again to edit or delete.