Understanding Kubernetes Architecture

1. Understanding Control Plane Components

The control plane manages cluster state, schedules workloads, and responds to events. Runs on master nodes (typically 3+ for HA).

ComponentRolePort
kube-apiserverREST API gateway, validates and persists objects to etcd6443
etcdDistributed key-value store; single source of truth for cluster state2379-2380
kube-schedulerAssigns Pods to Nodes based on resources, affinity, taints10259
kube-controller-managerRuns core controllers (Node, ReplicaSet, Endpoints, ServiceAccount)10257
cloud-controller-managerIntegrates cloud-provider APIs (LB, Routes, Volumes)10258

2. Understanding Node Components

ComponentPurpose
kubeletNode agent; ensures containers in PodSpecs run and are healthy
kube-proxyMaintains network rules (iptables/IPVS/nftables) for Service routing
Container runtimecontainerd (default), CRI-O, or Mirantis cri-dockerd; implements CRI
CNI pluginCalico, Cilium, Flannel — sets up pod networking

3. Understanding Pods as Deployment Units

PropertyDescription
Atomic unitSmallest deployable object; 1+ tightly-coupled containers
Shared networkContainers share IP, port space, localhost
Shared storageContainers share mounted volumes
EphemeralPods are not self-healing; managed by controllers

4. Understanding Services and Networking

TypeScopeUse Case
ClusterIPInternal VIPDefault; service-to-service in cluster
NodePortEach node's IP:port (30000-32767)External access for dev/testing
LoadBalancerCloud LBPublic-facing services with cloud provider
ExternalNameCNAME aliasMap service to external DNS
HeadlessclusterIP: NoneDirect pod DNS for StatefulSets

5. Understanding Workload Resources

ResourceUse For
DeploymentStateless apps; rolling updates, rollback
StatefulSetStateful apps with stable network IDs and persistent storage
DaemonSetOne pod per node (log agents, CNI, monitoring)
JobRun-to-completion batch tasks
CronJobScheduled jobs (cron syntax)
ReplicaSetMaintain replica count (managed by Deployment)

6. Understanding Storage Abstractions

ObjectPurpose
VolumeStorage attached to Pod lifecycle
PersistentVolume (PV)Cluster-scoped storage resource
PersistentVolumeClaim (PVC)User request for storage; binds to PV
StorageClassProvisioner template for dynamic PV creation
CSI driverPluggable storage backend (EBS, GCE PD, Ceph)
VolumeSnapshotPoint-in-time snapshot for backup/clone

7. Understanding Configuration Resources

ResourcePurposeSize Limit
ConfigMapNon-confidential key-value config1 MiB
SecretSensitive data (base64-encoded, optionally encrypted at rest)1 MiB
Downward APIExpose pod/container metadata to containers

8. Understanding Namespaces and Multi-Tenancy

NamespacePurpose
defaultUsed when no namespace specified
kube-systemControl-plane components
kube-publicCluster-readable resources
kube-node-leaseNode heartbeats (lease objects)
User namespacesRBAC, quota, network-policy isolation boundaries

9. Understanding API Resources and Extensions

MechanismUse
CustomResourceDefinition (CRD)Add new resource types
API Aggregation LayerExtend API server with custom APIs
Admission WebhooksValidate/mutate objects on write
OperatorCustom controller + CRD for domain logic

10. Understanding Cluster Add-Ons

Add-OnFunction
CoreDNSCluster DNS for service discovery
Metrics ServerPod/Node resource metrics for HPA/VPA
Ingress ControllerL7 HTTP routing (NGINX, Traefik, HAProxy)
DashboardWeb UI for cluster management
CNI pluginPod networking (Calico, Cilium)

Cluster Architecture

┌──────────── Control Plane ─────────────┐
│  api-server ←→ etcd                    │
│      ↑                                 │
│  scheduler   controller-manager        │
└────────────────┬───────────────────────┘
                 │ (kubelet ↔ apiserver)
   ┌─────────────┼─────────────┐
   ▼             ▼             ▼
 Node1         Node2         Node3
 kubelet       kubelet       kubelet
 kube-proxy    kube-proxy    kube-proxy
 [Pods]        [Pods]        [Pods]