Kubernetes: Container Orchestration for Microservices

Learn Kubernetes fundamentals, deploy a sample app locally, and evaluate workloads, networking, scaling, security, and the operational cost of a cluster.

published: reading time: 10 min read author: Geek Workbench updated: November 22, 2026
Quick Summary

Kubernetes runs containerized workloads by reconciling declared state with the state of a cluster. This guide maps the control plane, nodes, Pods, workload controllers, Services, configuration, storage, scaling, and security, then shows a local Deployment and helps you decide whether the operational work of a cluster fits your team.

Kubernetes: Container Orchestration for Microservices

Kubernetes runs containerized workloads across a group of machines called a cluster. You declare what should run, and controllers work to bring the actual cluster toward that state.

That process has limits. Kubernetes can restart a failed container or replace a Pod managed by a controller. It cannot repair a bug, make a database replica safe, restore lost data, or provide capacity when the cluster has none.

This page is a map of the main pieces and a short local deployment path. The focused guides linked below cover the day-to-day details.

How a cluster fits together

The control plane exposes the Kubernetes API and stores cluster state. The scheduler assigns unscheduled Pods to nodes. Controllers compare desired and actual state and create, update, or remove resources. On each node, the kubelet works with a container runtime to run the assigned Pods.

flowchart LR
    User[Operator or CI] --> API[API server]
    API --> State[(Cluster state)]
    API --> Scheduler[Scheduler]
    API --> Controllers[Controllers]
    Scheduler --> NodeA[Node]
    Controllers --> NodeA
    NodeA --> PodA[Pod]
    NodeA --> PodB[Pod]
    NodeB[Node] --> PodC[Pod]

A Pod is the smallest unit Kubernetes schedules. It holds one or more containers that share a network namespace and can share mounted volumes. Most applications use a controller rather than creating Pods directly. A Deployment manages interchangeable replicas; a StatefulSet adds stable identity and per-replica claims; a DaemonSet places a Pod on each eligible node. These controllers do not supply application-level replication or data recovery. See the workload resources guide.

Version scope and a local first deployment

The examples use Kubernetes v1.37 APIs, including apps/v1, networking.k8s.io/v1, and autoscaling/v2. The local walkthrough uses kind v0.33.0 with its Kubernetes v1.37.0 node image and kubectl v1.37.1. The client and server are on the same minor release, within the supported version skew. Check the kind release notes, kind quick start, and kubectl version policy for current installation details.

Install kind v0.33.0 and kubectl v1.37.1 first. You also need a container runtime supported by kind. This is a local learning example; it is not a production configuration.

Create a cluster with the versioned kind node image:

kind create cluster --name k8s-intro \
  --image kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 \
  --wait 5m

kubectl version --client
kubectl cluster-info --context kind-k8s-intro

Save this manifest as web-demo.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web-demo
  template:
    metadata:
      labels:
        app: web-demo
    spec:
      containers:
        - name: nginx
          image: nginx:1.31.9-alpine
          ports:
            - name: http
              containerPort: 80
          readinessProbe:
            httpGet:
              path: /
              port: http
            periodSeconds: 5

Apply it, wait for the Pod to become ready, then open a local tunnel:

kubectl apply -f web-demo.yaml
kubectl rollout status deployment/web-demo --timeout=2m
kubectl port-forward deployment/web-demo 8080:80

While the port-forward command is running, visit http://127.0.0.1:8080. Stop the port-forward with Ctrl-C, then remove the Deployment and local cluster:

kubectl delete -f web-demo.yaml
kind delete cluster --name k8s-intro

The manifest uses apps/v1. Kubernetes API versions are part of the manifest contract; check the API reference for the cluster version you operate and use a kubectl client within the supported version skew.

Core concepts

Workloads and desired state

A controller keeps a workload near its declared replica count or placement rule. A Deployment can replace one interchangeable Pod with another. StatefulSets and DaemonSets cover different identity and node-placement needs. Jobs and CronJobs run work to completion or on a schedule.

A rollout changes a Pod template, then the controller replaces Pods according to its update strategy. Readiness, available capacity, and compatibility between application versions affect whether users notice the change. A rollback restores an earlier workload template; it does not undo a database schema change or restore data.

Use the workload guide for probes, shutdown handling, rollout behavior, and storage tests.

Services and external traffic

Pod IPs can change as Pods are replaced. A Service gives a stable name and virtual IP for a selected group of ready Pods. Cluster DNS lets one workload find another by Service name.

For external HTTP traffic, Kubernetes still serves the stable Ingress API, but the API is frozen and the Kubernetes project recommends Gateway API for new work. Either way, a controller must implement the routing resource. See the Ingress documentation and read the Services and Networking guide before choosing an Ingress or Gateway controller.

Configuration and namespaces

ConfigMaps hold non-sensitive configuration. Secrets are intended for sensitive values, but their contents are base64 encoded by default and are not encrypted at rest unless the cluster is configured for it. Restrict access with RBAC, enable encryption at rest where required, and avoid committing real credentials to manifests or source control.

Namespaces scope names and many policies. They help teams organize resources, but they are not a strong isolation boundary by themselves. For configuration delivery, rotation, encryption, and access examples, see the ConfigMaps and Secrets guide.

Resource requests and scaling

The scheduler uses resource requests when deciding where a Pod can run. Runtime limits affect what a container can consume. Tune them from measurements; the right values depend on the workload.

A HorizontalPodAutoscaler (HPA) can adjust a workload’s replica count from observed metrics. Resource metrics such as CPU and memory are served through metrics.k8s.io, commonly supplied by Metrics Server. Custom and external metrics use custom.metrics.k8s.io and external.metrics.k8s.io, provided by adapters. The autoscaling/v2 API supports these metric sources; Kubernetes does not provide every metrics adapter as part of the core control plane. See the HPA documentation for the available metric APIs.

A cluster autoscaler is a separate component or provider feature that may add or remove nodes. It has its own provider configuration and limits. The resource limits guide covers requests, limits, and autoscaling inputs. The high availability guide covers replica placement and disruption budgets.

A PodDisruptionBudget (PDB) limits voluntary Pod evictions made through the eviction API, such as a supported node drain. It does not stop involuntary failures and does not constrain Deployment or StatefulSet rolling updates. Set a budget only when it matches the application’s capacity and recovery behavior. See the Kubernetes disruption docs.

Storage

A PersistentVolumeClaim requests storage. The StorageClass and storage driver determine how that storage is provisioned, attached, mounted, and recovered. StatefulSet identity and a PVC do not make the application replication-safe, and a volume is not a backup. Test restores with disposable data.

The storage guide explains access modes, topology, CSI behavior, and restore checks.

Scheduling and network policy

Node selectors, affinity rules, taints, tolerations, and topology spread constraints affect where Pods run. These controls do not create capacity; strict placement rules can leave Pods Pending if no node matches. Start with the advanced scheduling guide.

NetworkPolicy resources describe allowed Pod traffic, but enforcement depends on the cluster’s network plugin. Check what the CNI implements and verify policies in a test namespace before relying on isolation. The Network Policies guide covers a practical test process.

Security and extensions

RBAC controls what a user or workload identity can do through the API. Grant the minimum permissions needed. Pod Security Admission enforces Pod Security Standards at the namespace level; PodSecurityPolicy was removed in Kubernetes v1.25. See the Pod Security Admission documentation for current policy modes. Cluster configuration still matters: protect the API, etcd, node access, and credentials.

Custom controllers watch resources and act on them. Operators package controllers with application-specific behavior. Multi-cluster management adds separate problems around identity, networking, placement, and failover. Continue with the custom controllers guide or the multi-cluster guide.

Packaging manifests

Helm renders chart templates from values and packages them for release. Kustomize builds an overlay from base YAML and patches. Choose the tool your team can review and release consistently; rendering manifests does not validate whether the resulting change is safe for the application. See the Kustomize guide for a version-pinned build and review workflow.

When Kubernetes adds more work than value

Kubernetes is useful when its scheduling, rollout, service discovery, and policy model solve problems your team already has. It can also make sense when the same platform needs to run in several environments and your organization can support that consistency.

The operational bill is real: cluster upgrades, node capacity, networking, storage, identity, monitoring, incident response, and on-call ownership. If the workload is a small service with steady traffic, few deployment dependencies, and no need for cluster-level controls, a managed container platform or a simpler hosting service may be easier to operate. Virtual machines can also be the clearer choice when you need host-level control or have an application that does not fit a container workflow.

Ask who will maintain the cluster, respond to failures, validate upgrades, and test backups. If no team can own that work, Kubernetes may move the complexity rather than remove it. Revisit the choice when scaling, deployment frequency, environment consistency, or policy requirements change. There is no service-count threshold that decides this for every team.

Production readiness checklist

Before production, write down the decisions and verify them in the environment that will run the workload:

  • Replicas and placement cover the failure domains the application can tolerate; no universal replica count fits every workload.
  • Resource requests and limits are based on observed usage, and capacity leaves room for rollouts and expected spikes.
  • Startup, readiness, and liveness probes match the application; shutdown handles SIGTERM within the configured grace period.
  • Rollout and rollback procedures have been rehearsed, including database migration compatibility.
  • PDB settings cover voluntary disruptions only and do not substitute for application-level availability.
  • Persistent data uses a supported storage path, and a restore to a separate PVC has been verified.
  • External traffic, DNS, and TLS are owned and tested through the chosen controller.
  • Network policy enforcement is supported by the CNI and verified with the traffic the app needs.
  • RBAC, Pod Security Admission, image policy, and secret handling match the cluster’s threat model.
  • Metrics, logs, events, and audit records reach the systems used during incidents.
  • A named team owns control-plane and node upgrades, CNI/CSI compatibility, cost, and incident response.

Network policy and Pod Security defaults need to match application and cluster requirements. A default-deny policy can be a good starting point, but only if required DNS, ingress, egress, and health traffic are explicitly allowed and the network plugin enforces the policy. The high availability guide and network policy guide include focused examples.

Conclusion

Kubernetes provides a common API for declaring workloads and coordinating changes across a cluster. It also brings infrastructure and operational work your team must own. Try the local Deployment, follow the focused guides for the systems you need, and compare that operating cost with the value Kubernetes gives your workloads.

Category

Related Posts

Advanced Kubernetes: A Guide to Production Decisions

Choose when to use controllers, network policies, configuration, scheduling, storage, and availability patterns, with versioned checks and focused guides.

#kubernetes #containers #devops

Docker Fundamentals

Learn Docker containerization fundamentals: images, containers, volumes, networking, and best practices for building and deploying applications.

#docker #containers #devops

Helm Charts: Templating, Values, and Hooks

Build Helm charts with values, templates, dependencies, hooks, and schema validation. Examples target Helm v4.3.1 and focus on chart authoring.

#kubernetes #helm #devops