Skip to content

Room 50

MULTI-CLUSTER KIND


The Federated Realms

  • Real-world Kubernetes often means multiple clusters - dev, staging, prod.
  • Kind lets you run several clusters simultaneously for multi-cluster experiments.

📜 Mission Briefing

  1. Create two Kind clusters: cluster-east and cluster-west.
  2. Configure kubectl contexts for both clusters.
  3. Deploy an app in cluster-east and a database in cluster-west.
  4. Switch between contexts seamlessly.
  5. The combined node count across both clusters reveals the password: multiclr.

Key Commands
Command Purpose
kind get clusters List all Kind clusters
kind create cluster --name east Create named cluster
kubectl config get-contexts List all contexts
kubectl config use-context kind-east Switch context
kubectl config current-context Show active context

Multi-Cluster with Kind
# Create multiple Kind clusters
kind create cluster --name cluster-east --config east-config.yaml
kind create cluster --name cluster-west --config west-config.yaml

# Kind automatically sets up kubeconfig contexts
# Context names: kind-cluster-east, kind-cluster-west
kubectl config get-contexts
# CURRENT   NAME                  CLUSTER               AUTHINFO
# *         kind-cluster-east     kind-cluster-east     kind-cluster-east
#           kind-cluster-west     kind-cluster-west     kind-cluster-west
# east-config.yaml: 2-node cluster
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
networking:
  podSubnet: "10.244.0.0/16"
  serviceSubnet: "10.96.0.0/12"
# west-config.yaml: 2-node cluster
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
networking:
  podSubnet: "10.245.0.0/16"
  serviceSubnet: "10.97.0.0/12"
# Working with multiple clusters
# Deploy app to east
kubectl --context kind-cluster-east apply -f app-deployment.yaml
kubectl --context kind-cluster-east get pods

# Deploy database to west
kubectl --context kind-cluster-west apply -f db-deployment.yaml
kubectl --context kind-cluster-west get pods

# Quick context switching
kubectl config use-context kind-cluster-east
kubectl get pods   # Shows east pods

kubectl config use-context kind-cluster-west
kubectl get pods   # Shows west pods
# Using kubectx for easier switching (if installed)
# kubectx kind-cluster-east
# kubectx kind-cluster-west

# Merge kubeconfigs
# KUBECONFIG=~/.kube/east:~/.kube/west kubectl config view --merge

# Cross-cluster service discovery patterns:
# 1. Submariner - connects pod/service networks across clusters
# 2. Istio multi-cluster - service mesh spanning clusters
# 3. KubeFed - federated resource placement
# 4. Liqo - virtual node multi-cluster resource sharing

# Cleanup
kind delete cluster --name cluster-east
kind delete cluster --name cluster-west

Hints

Hint 1

kind create cluster --name cluster-east --config east-config.yaml
kind create cluster --name cluster-west --config west-config.yaml

Hint 2

kubectl --context kind-cluster-east get nodes --no-headers | wc -l
kubectl --context kind-cluster-west get nodes --no-headers | wc -l
# Total: 4 nodes

Hint 3

The password is multiclr.


🔓 Unlock Room 51

openssl enc -aes-256-cbc -d -a -pbkdf2 \
        -in ../room_51/README -out ../room_51/README.txt -pass pass:PASSWORD
cat ../room_51/README.txt