Skip to content

☁️ Containers and Kubernetes

Kubernetes basics are the fundamental concepts that explain how Kubernetes runs containers, keeps applications healthy, scales workloads, and abstracts infrastructure. Kubernetes is the evolution of virtualization: instead of managing VMs, you manage containerized workloads through declarative configuration and automated orchestration.

The concise takeaway: Kubernetes is a container orchestration platform that schedules, scales, heals, and exposes containerized applications.


Kubernetes automates:

  • Deployment
  • Scaling
  • Networking
  • Storage
  • Health checks
  • Self‑healing
  • Rolling updates

It treats infrastructure as a cluster and workloads as declarative objects.


A Kubernetes cluster consists of:

  • Control Plane — API server, scheduler, controller manager
  • Worker Nodes — run your containers

Nodes run the container runtime (containerd, CRI‑O) and the kubelet agent.


The smallest deployable unit in Kubernetes.
A Pod contains:

  • One or more containers
  • Shared network namespace
  • Shared storage volumes

Pods are ephemeral — Kubernetes replaces them automatically when needed.


Deployments manage stateless applications.
They provide:

  • Replica management
  • Rolling updates
  • Rollbacks
  • Self‑healing

Deployments ensure your desired number of Pods always run.


Services expose Pods to the network.
Types include:

  • ClusterIP (internal)
  • NodePort (external via nodes)
  • LoadBalancer (cloud LB integration)
  • Headless services (for stateful apps)

Services provide stable networking even when Pods change.


Ingress manages HTTP/HTTPS routing into the cluster.
It supports:

  • Path‑based routing
  • Host‑based routing
  • TLS termination
  • Reverse proxying

Ingress controllers include NGINX, Traefik, HAProxy, and cloud‑native controllers.


Configuration and sensitive data are stored separately from container images.

  • ConfigMaps → non‑sensitive config
  • Secrets → passwords, tokens, certificates

They are injected into Pods as environment variables or mounted files.


Volumes provide persistent storage for Pods.
Types include:

  • EmptyDir
  • HostPath
  • PersistentVolume (PV)
  • PersistentVolumeClaim (PVC)
  • Cloud storage (EBS, Azure Disk, GCP PD)

Stateful workloads use StatefulSets + persistent volumes.


Used for stateful applications (databases, queues).
They provide:

  • Stable network identities
  • Ordered deployment
  • Persistent storage binding

StatefulSets complement Deployments for workloads that require identity.


Namespaces logically isolate resources.
Useful for:

  • Multi‑team clusters
  • Dev/Test/Prod separation
  • RBAC boundaries

They help organize large clusters.


⚙️ How Kubernetes Works (The Control Loop)

Section titled “⚙️ How Kubernetes Works (The Control Loop)”

Kubernetes uses a declarative model:

  1. You declare the desired state (e.g., 3 replicas).
  2. Kubernetes continuously compares desired vs actual state.
  3. Controllers reconcile differences automatically.

This is the core of Kubernetes automation.


Security is enforced through:

  • RBAC (Role‑Based Access Control)
  • Network Policies
  • Secrets encryption
  • Pod Security Standards
  • Service Accounts

Identity and access are central to cluster governance.


Kubernetes automatically:

  • Restarts failed Pods
  • Replaces unhealthy nodes
  • Scales workloads based on CPU/memory
  • Distributes Pods across nodes

Horizontal Pod Autoscalers (HPA) and Vertical Pod Autoscalers (VPA) handle scaling.


SysAdmins use Kubernetes for:

  • Microservices
  • API platforms
  • Internal apps
  • CI/CD pipelines
  • Cloud‑native workloads
  • Hybrid infrastructure

It’s the standard for container orchestration across AWS, Azure, GCP, and on‑prem (Kubernetes, AKS, EKS, GKE, OpenShift, Rancher).


Kubernetes basics include:

  • Clusters (control plane + nodes)
  • Pods (containers)
  • Deployments (stateless apps)
  • StatefulSets (stateful apps)
  • Services (stable networking)
  • Ingress (HTTP routing)
  • ConfigMaps/Secrets (configuration)
  • Volumes/PVCs (storage)
  • Namespaces (organization)

Kubernetes provides automated deployment, scaling, networking, and self‑healing for containerized applications.