Kubernetes Architecture and kubectl

Understand the control plane, nodes, the reconciliation loop and the declarative API before touching workloads.

Intermediate · about 10 hours · difficulty 3/5

Learn first: Containers and Docker Basics, Container Registries

Kubernetes is a platform for running containers across a cluster of machines. Its central idea is declarative desired state: you tell the API what should exist, and controllers continuously reconcile reality toward it.

Components

  • Control plane: the API server (everything goes through it), etcd (the state store), the scheduler (places pods on nodes), and the controller manager (runs reconciliation loops).
  • Nodes: the kubelet (starts pods via a container runtime like containerd), kube-proxy or an eBPF replacement for service networking, and a CNI plugin for pod networking.
  • Managed offerings (EKS, GKE, AKS) run the control plane for you.

Working with the API

  • Everything is an object with apiVersion, kind, metadata and spec, stored as YAML manifests.
  • kubectl apply -f, get, describe, logs, exec, port-forward, explain, get events --sort-by=.lastTimestamp.
  • Namespaces, labels and selectors organise and connect objects.
  • Contexts in ~/.kube/config choose which cluster you talk to.

Local practice

kind, minikube or k3d give you a cluster on a laptop in a minute.

Pitfalls

Imperative kubectl edit changes that drift from git, and running commands against the wrong context (show it in your prompt).

Good enough to move on: you can explain what happens from kubectl apply to a running container, and debug a pending or crashing pod using describe, events and logs.

Key concepts

  • API server, etcd, scheduler, controllers
  • kubelet, runtime and CNI
  • Declarative manifests and reconciliation
  • kubectl essentials
  • Namespaces, labels, selectors
  • kind / minikube / k3d
  • Managed Kubernetes (EKS, GKE, AKS)
  • k9s and kubectx

Mini project

Create a local cluster with kind, deploy a pod with a deliberately wrong image name, and use describe, events and logs to diagnose and fix it; then write down each control plane component that was involved.

Check yourself

If you delete a pod created by a Deployment, why does a new one appear, and which component makes that happen?

Free resources