0
0
Kubernetesdevops~10 mins

High availability cluster setup in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - High availability cluster setup
Start: Plan HA Cluster
Provision Multiple Master Nodes
Configure etcd Cluster
Set Up Load Balancer for Masters
Join Worker Nodes to Cluster
Verify Cluster Health & Failover
End: HA Cluster Ready
This flow shows the main steps to set up a Kubernetes high availability cluster, from planning to verifying failover.
Execution Sample
Kubernetes
kubeadm init --control-plane-endpoint "LOAD_BALANCER_DNS:6443" --upload-certs
kubeadm join LOAD_BALANCER_DNS:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash> --control-plane
kubectl get nodes
kubectl get pods -n kube-system
Commands to initialize HA control plane, join nodes, and check cluster status.
Process Table
StepActionCommand/ConfigResult/Output
1Initialize first master node with control plane endpointkubeadm init --control-plane-endpoint "LOAD_BALANCER_DNS:6443" --upload-certsMaster node initialized, certificates uploaded, control plane endpoint set
2Join additional master nodes to control planekubeadm join LOAD_BALANCER_DNS:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash> --control-planeAdditional master nodes joined, etcd cluster formed
3Set up external load balancer pointing to master nodesConfigure load balancer with masters' IPs on port 6443Load balancer routes API requests to healthy masters
4Join worker nodes to clusterkubeadm join LOAD_BALANCER_DNS:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>Worker nodes joined and ready
5Verify nodes and pods statuskubectl get nodes kubectl get pods -n kube-systemAll nodes Ready, system pods Running
6Simulate master node failureShutdown one master nodeLoad balancer routes traffic to remaining masters, cluster remains functional
7ExitN/AHA cluster operational with failover
💡 HA cluster setup completes when multiple masters are joined, load balancer routes traffic, and failover works
Status Tracker
VariableStartAfter Step 1After Step 2After Step 4Final
Master Nodes01 (initialized)3 (joined control plane)33 (all active)
Worker Nodes0002 (joined)2 (all Ready)
Load BalancerNot configuredNot configuredConfigured with 3 mastersConfiguredConfigured and routing
Cluster HealthNot availableHealthy (single master)Healthy (HA masters)Healthy (masters + workers)Healthy with failover
Key Moments - 3 Insights
Why do we need a load balancer in front of master nodes?
The load balancer distributes API requests to all healthy master nodes, ensuring availability if one master fails. See execution_table step 3 and 6 where load balancer setup and failover are shown.
What happens if a master node goes down?
The load balancer routes traffic to remaining masters, so the cluster stays functional without downtime. This is shown in execution_table step 6.
Why do worker nodes join using the load balancer DNS instead of a single master IP?
Using the load balancer DNS ensures workers can always reach an active master, even if one master fails. Refer to execution_table steps 2 and 4.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step are additional master nodes joined to the control plane?
AStep 2
BStep 1
CStep 4
DStep 5
💡 Hint
Check the 'Action' column for 'Join additional master nodes' in execution_table.
According to variable_tracker, how many worker nodes are active after step 4?
A0
B1
C2
D3
💡 Hint
Look at the 'Worker Nodes' row under 'After Step 4' in variable_tracker.
If the load balancer was not configured, what would likely happen during master node failure?
ACluster continues working without issues
BAPI requests fail because no failover routing exists
CWorker nodes automatically become masters
DNew load balancer is created automatically
💡 Hint
Refer to key_moments about load balancer role and execution_table step 3 and 6.
Concept Snapshot
High Availability Cluster Setup in Kubernetes:
- Use multiple master nodes for control plane redundancy
- Configure an external load balancer to route API requests
- Join worker nodes via load balancer DNS
- Verify cluster health and failover by simulating master failure
- Ensures no single point of failure for control plane
Full Transcript
This visual execution shows how to set up a Kubernetes high availability cluster. First, you initialize the first master node with a control plane endpoint pointing to a load balancer. Then, you join additional master nodes to form an etcd cluster and control plane. Next, you configure an external load balancer to route API requests to all healthy masters. Worker nodes join the cluster using the load balancer DNS to ensure connectivity. Finally, you verify the cluster health by checking nodes and pods status. Simulating a master node failure shows that the load balancer routes traffic to remaining masters, keeping the cluster operational without downtime.