deployed_code kubernetes + devops · orchestration guide

Kubernetes & DevOps —
orchestrate · scale · self-heal

Kubernetes is the industry standard for container orchestration — automating deployment, scaling, and management of containerized applications at scale. Master it to build resilient, cloud-native systems.

package Containers
sync_alt
Orchestrate rocket

What Kubernetes is

Originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF), Kubernetes (K8s) is an open-source system for automating the deployment, scaling, and management of containerized applications.

Rather than manually managing individual servers and containers, Kubernetes lets teams declare the desired state of their infrastructure. The system continuously works behind the scenes to ensure that the actual state matches that desired state.

Kubernetes abstracts away underlying infrastructure complexity, empowering teams to build resilient, scalable systems that can handle the demands of modern users.

~/k8s-basics
$ kubectl get nodes
NAME STATUS ROLES AGE
node-1 Ready master 45d
node-2 Ready worker 45d
node-3 Ready worker 45d
 
$ kubectl get pods
NAME READY STATUS RESTARTS
app-7d8f9 1/1 Running 0

Containers and orchestration

Running a few containers on a laptop is vastly different from running hundreds or thousands across a distributed cloud architecture. Orchestration solves this complexity.

rolling

Automated rollouts & rollbacks

Gradually changes app deployment while monitoring health — automatically rolling back if something goes wrong.

dns

Service discovery & load balancing

Exposes containers using a DNS name or IP address and distributes traffic across healthy instances.

storage

Storage orchestration

Automatically mounts storage systems — cloud, network, or local — to containers as needed.

Pods and Deployments

group Pods

The smallest deployable unit in Kubernetes. A Pod represents a single instance of a running process and can contain one or more tightly coupled containers that share storage and network resources.

  • check Co-located containers share the same network namespace
  • check Can share storage volumes
  • check Ephemeral by nature — replaced when unhealthy

deployed_code Deployments

A higher-level API object that manages Pods. A Deployment ensures a specified number of identical Pods are running and healthy at any given time, handling updates and rollouts seamlessly.

apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 selector: matchLabels: app: nginx

Services

Containers are ephemeral — created, destroyed, and replaced dynamically. Individual Pod IP addresses change constantly, making direct networking impossible.

Services provide a stable, reliable endpoint (a single IP and DNS name) that routes traffic to a set of dynamic Pods, decoupling clients from backend containers.

dns Service types

  • check ClusterIP — internal cluster access only
  • check NodePort — exposes on a static port on each node
  • check LoadBalancer — integrates with cloud provider load balancers
  • check Ingress — HTTP/HTTPS routing with host-based rules

Scaling applications

manual Manual scaling

Adjust the replica count in a Deployment configuration file with a single command:

$ kubectl scale deployment nginx --replicas=5 deployment.apps/nginx scaled

auto Horizontal Pod Autoscaler (HPA)

Automatically scales the number of Pods up or down based on observed CPU utilization, memory usage, or custom metrics.

  • check Optimal resource utilization
  • check Responds to traffic spikes
  • check Reduces cost during low demand

Self-healing infrastructure

Kubernetes is designed with resilience at its core. It provides automatic self-healing mechanisms to keep applications running without human intervention.

restart_alt

Restart failed containers

If a container crashes, Kubernetes automatically restarts it.

swap_horiz

Replace and reschedule

If a node goes offline, Kubernetes detects the failure and reschedules affected Pods onto healthy nodes.

health

Health checks (Probes)

Liveness and readiness probes continuously monitor application health, removing unhealthy Pods from traffic rotation.

Kubernetes in production

cloud Managed Kubernetes

Cloud provider solutions reduce operational overhead of managing the control plane:

  • check Amazon EKS — AWS managed Kubernetes
  • check Google GKE — Google Cloud's managed offering
  • check Azure AKS — Microsoft's managed Kubernetes

shield Security & access control

  • check Role-Based Access Control (RBAC)
  • check Network policies
  • check Secure container image scanning

visibility Observability

Integrate robust logging, monitoring, and tracing tools:

  • check Prometheus — metrics collection and alerting
  • check Grafana — visualization and dashboards
  • check Fluentbit — log aggregation and forwarding
  • check Jaeger — distributed tracing

cost Cost management

Monitor resource usage with tools like Kubecost to optimize cluster spending and right-size workloads.

Advanced Kubernetes topics

config

ConfigMaps & Secrets

Decouple configuration and sensitive data from container images — manage environment-specific configs and credentials.

storage

Persistent Volumes (PV) & Claims (PVC)

Abstract storage details from applications — dynamically provision storage for stateful workloads like databases.

state

StatefulSets

Manage stateful applications with stable, unique network identifiers and persistent storage — ideal for databases and message queues.

cron

CronJobs

Schedule recurring tasks — database backups, report generation, cleanup jobs — on a time-based schedule.

extension

Operators

Custom controllers that extend Kubernetes with application-specific knowledge — automating complex stateful application management.

network

Service Mesh

Istio, Linkerd, or Consul add advanced traffic management, security, and observability to service-to-service communication.

Kubernetes & DevOps culture

groups Shift in team mindset

Kubernetes changes how teams work — it's not just a tool, it's a platform that enables:

  • check Self-service — developers can deploy with minimal ops involvement
  • check Standardization — consistent deployment patterns across teams
  • check Shared ownership — developers own their apps end-to-end

rocket GitOps with Kubernetes

Storing Kubernetes manifests in Git enables:

  • check Declarative configuration — infrastructure as code
  • check Automated sync — changes in Git reconcile the cluster
  • check Auditable rollbacks — revert a bad deployment with git revert

Tools: Argo CD, Flux

References & further reading

article
CNCF — Kubernetes: The official documentation and learning resources
article
Kubernetes.io — Interactive tutorials and concepts
article
Google — Borg: The predecessor to Kubernetes
article
CNCF Landscape — The full cloud-native ecosystem
article
GitOps — Argo CD and Flux documentation
article
Kubernetes Patterns — Reusable design patterns for cloud-native apps