All exams← All Certified Kubernetes Administrator (CKA) notes

Cluster Architecture, Installation & Configuration: Certified Kubernetes Administrator (CKA) revision notes

Revision notes

## Kubernetes Cluster Architecture

A Kubernetes cluster consists of a set of control plane components and worker nodes. The control plane manages the cluster, while worker nodes run the actual applications (pods).

## Control Plane Components

These components make global decisions about the cluster (e.g., scheduling) and detect and respond to cluster events.

  • kube-apiserver: The front-end of the Kubernetes control plane. It exposes the Kubernetes API, which all other components and users interact with. It's the only control plane component directly exposed.
  • etcd: A consistent and highly available key-value store that stores all cluster data, configuration, and state. It's the single source of truth for the cluster.
  • kube-scheduler: Watches for newly created Pods with no assigned node and selects a node for them to run on, based on resource requirements, policies, and affinity/anti-affinity specifications.
  • kube-controller-manager: Runs various controller processes. Each controller is a separate process, but they are compiled into a single binary to reduce complexity. Examples include the Node Controller, Replication Controller, Endpoints Controller, and Service Account & Token Controllers.
  • cloud-controller-manager: (Optional) Interacts with the underlying cloud provider to manage cloud-specific resources like load balancers, persistent volumes, and node lifecycle.

## Worker Node Components

These components run on each worker node and are responsible for maintaining running pods and providing the Kubernetes runtime environment.

  • kubelet: An agent that runs on each node in the cluster. It ensures that containers are running in a Pod as specified by the control plane. It registers the node with the API server.
  • kube-proxy: A network proxy that runs on each node. It maintains network rules on nodes, allowing network communication to your Pods from network sessions inside or outside the cluster. It handles Service abstraction.
  • Container Runtime: The software responsible for running containers. Kubernetes supports various runtimes through the Container Runtime Interface (CRI), such as containerd, CRI-O, or Docker (via containerd shim).

## Cluster Installation & Configuration with kubeadm

kubeadm is a tool designed to easily bootstrap a minimum viable Kubernetes cluster. It handles the setup of control plane components and allows worker nodes to join.

  • `kubeadm init`: Initializes a control plane node. It performs pre-flight checks, generates certificates, sets up the kube-apiserver, etcd, kube-scheduler, and kube-controller-manager as static pods or systemd services.
  • `kubeadm join`: Allows worker nodes to join an existing cluster. It takes a token and the control plane's IP address to securely connect.
  • Pod Network Add-on (CNI): After `kubeadm init`, a Container Network Interface (CNI) plugin (e.g., Calico, Flannel) must be installed to enable pod-to-pod communication. Without it, pods will remain in a `Pending` state or fail to communicate.
  • kubeconfig: A file that stores cluster access information (cluster details, user credentials, context) for `kubectl` and other tools.

Key facts

Flashcards

What is the primary function of the **kube-apiserver**?
It exposes the Kubernetes API and is the front-end for the control plane, handling all communication.
tap to reveal
Which component stores the entire state of the Kubernetes cluster?
**etcd**
tap to reveal
What is the role of the **kubelet** on a worker node?
It's an agent that ensures containers are running in a Pod as specified by the control plane.
tap to reveal
What does `kubeadm init` accomplish?
It initializes a Kubernetes control-plane node, setting up all necessary control plane components and certificates.
tap to reveal
Why is a **CNI plugin** necessary for a Kubernetes cluster?
It provides pod networking, allowing pods to communicate with each other across nodes.
tap to reveal
What is the purpose of **kube-proxy**?
It maintains network rules (e.g., iptables or IPVS) on nodes to enable network communication to Pods via Services.
tap to reveal
Where are the credentials and configuration for accessing a Kubernetes cluster stored?
In **kubeconfig** files.
tap to reveal
Name two components of the Kubernetes control plane.
kube-apiserver, etcd, kube-scheduler, kube-controller-manager (any two).
tap to reveal
Practice questions

Cluster Architecture, Installation & Configuration: 5 practice questions

Q1. Which Kubernetes control plane component is responsible for watching for newly created Pods with no assigned node and selecting a node for them to run on?
  • A.  kube-scheduler
  • B.  kube-apiserver
  • C.  etcd
  • D.  kube-controller-manager
Show answer & explanation
✓ Answer: A. kube-scheduler
The kube-scheduler is the component that makes scheduling decisions, assigning pods to available and suitable nodes based on constraints and resource availability.
Q2. You have successfully initialized a new Kubernetes cluster using `kubeadm init`. What is the correct `kubeadm` command to add a new worker node to this cluster?
  • A.  kubeadm connect --node-type=worker --token <token>
  • B.  kubeadm register --role=worker --cluster-info <cluster-info>
  • C.  kubeadm join <control-plane-ip>:<port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>
  • D.  kubeadm add-node --worker
Show answer & explanation
✓ Answer: C. kubeadm join <control-plane-ip>:<port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>
The `kubeadm join` command is used to bootstrap a new machine and join it to an existing Kubernetes cluster as either a worker or a control-plane node.
Q3. To perform a backup of an etcd cluster managed by kubeadm, which `etcdctl` command should you use?
  • A.  etcdctl export > etcd-dump.json
  • B.  etcdctl cluster-backup --file backup.tar.gz
  • C.  etcdctl backup --data-dir /var/lib/etcd --backup-dir /tmp/backup
  • D.  etcdctl snapshot save snapshot.db
Show answer & explanation
✓ Answer: D. etcdctl snapshot save snapshot.db
The correct command is `etcdctl snapshot save`. It requires API version 3 and certificates for authentication, but this is the core command for creating a point-in-time backup.
Q4. On a standard Kubernetes node set up with `kubeadm`, where is the primary configuration file for the kubelet service located?
  • A.  /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
  • B.  /etc/kubernetes/kubelet.conf
  • C.  /etc/kubernetes/manifests/kubelet.yaml
  • D.  /var/lib/kubelet/config.yaml
Show answer & explanation
✓ Answer: D. /var/lib/kubelet/config.yaml
Kubeadm uses a KubeletConfiguration file, typically located at `/var/lib/kubelet/config.yaml`, to manage the kubelet's configuration dynamically via a ConfigMap.
Q5. Which core component runs on every node in the cluster and is responsible for maintaining the network rules on nodes and performing connection forwarding?
  • A.  kubelet
  • B.  CoreDNS
  • C.  kube-proxy
  • D.  Container Network Interface (CNI) plugin
Show answer & explanation
✓ Answer: C. kube-proxy
kube-proxy runs on each node to maintain network rules. It enables network communication to your Pods from network sessions inside or outside of your cluster using iptables, IPVS, or other modes.
Test yourself
See the Certified Kubernetes Administrator (CKA) page

More Certified Kubernetes Administrator (CKA) topics