0
0
Kubernetesdevops~10 mins

High availability cluster setup in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the number of master nodes in a Kubernetes HA cluster.

Kubernetes
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
controlPlaneEndpoint: "loadbalancer.example.com:6443"
controllerManager:
  extraArgs:
    node-monitor-grace-period: "40s"
    node-monitor-period: "5s"
    pod-eviction-timeout: "1m0s"
scheduler:
  extraArgs:
    leader-elect: "true"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
nodeRegistration:
  name: master-1
  kubeletExtraArgs:
    node-labels: "node-role.kubernetes.io/master="
    authorization-mode: AlwaysAllow
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: JoinConfiguration
controlPlane:
  localAPIEndpoint:
    advertiseAddress: "192.168.1.10"
    bindPort: 6443
  [1]: 3
Drag options to blanks, or click blank then click option'
AmasterCount
BreplicaCount
CcontrolPlaneReplicas
Dreplicas
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'replicaCount' which is common in Helm charts but not in kubeadm config.
Using 'masterCount' which is not a valid kubeadm key.
2fill in blank
medium

Complete the command to initialize the Kubernetes control plane with high availability.

Kubernetes
kubeadm init --control-plane-endpoint [1] --upload-certs
Drag options to blanks, or click blank then click option'
A192.168.1.10:6443
Bloadbalancer.example.com:6443
Cmaster-1:6443
Dlocalhost:6443
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single master node IP instead of the load balancer.
Using localhost which is not accessible externally.
3fill in blank
hard

Fix the error in the kubeadm join command to add a new control plane node.

Kubernetes
kubeadm join loadbalancer.example.com:6443 --token [1] --discovery-token-ca-cert-hash sha256:abcdef1234567890 --control-plane --certificate-key abcdef1234567890
Drag options to blanks, or click blank then click option'
A0123456789abcdef
Babcdef
Cabcdef.0123456789abcdef
Dtoken1234
Attempts:
3 left
💡 Hint
Common Mistakes
Using incomplete or partial token strings.
Omitting the dot separator in the token.
4fill in blank
hard

Fill both blanks to create a Kubernetes Service manifest for the HA control plane load balancer.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: kubernetes
  namespace: default
spec:
  type: [1]
  ports:
  - port: 6443
    targetPort: 6443
  selector:
    [2]: master-node
Drag options to blanks, or click blank then click option'
ALoadBalancer
BClusterIP
Capp
Drole
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ClusterIP' which does not expose the service externally.
Using incorrect selector keys like 'app' when 'role' is expected.
5fill in blank
hard

Fill all three blanks to define a Pod Anti-Affinity rule to spread master nodes across failure domains.

Kubernetes
affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
    - labelSelector:
        matchExpressions:
        - key: [1]
          operator: In
          values:
          - master
      topologyKey: [2]
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: [3]
          operator: In
          values:
          - zone-a
          - zone-b
Drag options to blanks, or click blank then click option'
Akubernetes.io/role
Bkubernetes.io/hostname
Cfailure-domain.beta.kubernetes.io/zone
Dnode-role.kubernetes.io/master
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect label keys for roles or topology.
Confusing node labels with pod labels.