Kubernetes Cheat Sheet (2025 Edition) – From Beginner to Advanced


☸️ Kubernetes Cheat Sheet (2025 Edition) – From Beginner to Advanced

Kubernetes is powerful. But with so many moving parts — pods, services, YAMLs, CRDs, controllers — it’s easy to feel lost.

This cheat sheet is your go-to guide to everything Kubernetes — covering basic commands, architecture, YAML templates, security, Helm, GitOps, observability, and more.


🧠 1. What is Kubernetes?

Kubernetes is an open-source container orchestration system used to deploy, scale, and manage containerized applications automatically.

  • Created by Google
  • Maintained by CNCF
  • Runs everywhere — cloud, edge, or on-prem

🧱 2. Kubernetes Architecture

ComponentRole
Control PlaneSchedules & controls the cluster
NodeWorker machine (VM or physical)
PodSmallest unit, wraps 1+ containers
DeploymentEnsures desired state (e.g., 3 pods)
ServiceExposes pods (ClusterIP, NodePort, LoadBalancer)
IngressRoutes external traffic (domain-based rules)
ConfigMapNon-sensitive config
SecretSensitive credentials (API keys, passwords)
NamespaceLogical grouping (multi-tenant or per environment)

🔧 3. kubectl Cheat Sheet (Top Commands)

🔍 Basics

kubectl get nodes              # Show cluster nodes
kubectl get pods               # Show all pods
kubectl get svc                # Show services
kubectl get deployments        # Show deployments
kubectl get namespaces         # List namespaces

📦 Pod Management

kubectl logs <pod>             # View logs
kubectl exec -it <pod> -- bash # Shell inside container
kubectl describe pod <pod>    # Details of a pod
kubectl delete pod <pod>      # Delete pod

📂 Apply/Manage YAMLs

kubectl apply -f file.yaml     # Create/update resource
kubectl delete -f file.yaml    # Delete from config
kubectl create -f file.yaml    # Create resource
kubectl diff -f file.yaml      # Show changes before applying

🧪 Debugging & Test

kubectl explain pod            # Show schema
kubectl top pod                # Show CPU/RAM usage
kubectl port-forward svc/myapp 8080:80

✍️ 4. Essential YAML Templates

✅ Pod

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:latest

✅ Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: myimage:v1

✅ Service

apiVersion: v1
kind: Service
metadata:
  name: myapp-service
spec:
  type: LoadBalancer
  selector:
    app: myapp
  ports:
    - port: 80
      targetPort: 8080

📦 5. Resource Types Cheat Sheet

TypeDescription
PodRuns 1+ containers
DeploymentRolling updates, replica management
StatefulSetFor apps like databases, persistent identity
DaemonSetRuns 1 pod per node (e.g., logs agent)
JobOne-time tasks
CronJobScheduled jobs (like cron)
ConfigMapEnvironment configs
SecretEncrypted data
ServiceExpose app
IngressHTTP routing with host/path rules
PersistentVolumeClaim (PVC)Request storage from cluster
HorizontalPodAutoscalerScale pods by CPU/memory

🔐 6. Security Cheat Sheet

FeatureUse
RBACControl access (Role + RoleBinding)
NamespacesIsolate resources logically
Network PoliciesRestrict traffic between pods
Pod SecurityEnforce seccomp, runAsNonRoot
SecretsStore passwords, tokens
Admission ControllersEnforce rules before deploy

RBAC Example:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: dev
  name: pod-reader
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "watch", "list"]

🛠️ 7. Helm Cheat Sheet (K8s Package Manager)

📦 Install Helm

brew install helm

🧰 Helm Usage

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install myapp bitnami/nginx
helm upgrade myapp bitnami/nginx --set service.type=LoadBalancer
helm uninstall myapp

Benefits:

  • Templated YAMLs
  • Values override
  • Reusable charts

🔁 8. GitOps & ArgoCD

ToolPurpose
ArgoCDPull-based GitOps deployments
FluxLightweight GitOps tool
KustomizeOverlay-based YAML customizer

GitOps Flow:

  1. Git repo holds app + infra YAMLs
  2. ArgoCD syncs with Git
  3. Changes are auto-deployed to the cluster

📊 9. Observability & Monitoring

TypeTool
MetricsPrometheus
DashboardsGrafana
LogsLoki, Fluentd, EFK Stack
TracingJaeger, OpenTelemetry
AlertingAlertmanager, PagerDuty

🤖 10. Advanced Topics

TopicDescription
OperatorsCustom controllers for complex apps (e.g., DBs)
Custom Resource Definitions (CRDs)Extend K8s API
Pod Disruption BudgetsEnsure availability during node upgrade
Multi-cluster deploymentsManage apps across regions/clouds
Service Mesh (Istio, Linkerd)Traffic shaping, mTLS, telemetry
Admission WebhooksValidate/Mutate requests dynamically

🎯 Bonus: Kubernetes Interview Highlights

TopicSample Question
Pod LifecycleWhat are pod phases?
Rolling UpdatesHow does Kubernetes update apps without downtime?
Liveness vs ReadinessWhat’s the difference?
HPAHow does auto-scaling work in Kubernetes?
Network PoliciesHow do you restrict pod traffic?

Cheat Sheet PDF

🧭 Final Learning Path

1️⃣ Start with: kubectl, Pods, Services
2️⃣ Deploy apps: Deployments, Ingress
3️⃣ Add CI/CD: GitHub Actions + YAML
4️⃣ Secure it: Secrets, RBAC
5️⃣ Scale it: HPA, Helm, ArgoCD
6️⃣ Observe it: Prometheus, Grafana
7️⃣ Extend it: CRDs, Operators


🏁 Conclusion

Kubernetes is vast, but not impossible.

Use this cheat sheet as your guide — whether you’re:

  • Preparing for an interview
  • Managing production apps
  • Learning Kubernetes from scratch

“If Docker runs containers, Kubernetes runs production.”


Related Posts

Kubernetes RBAC cookbook: common roles (dev, SRE, read-only) safely

Kubernetes RBAC is one of those things that feels annoying until the day it saves your cluster from “oops, I deleted prod.” The tricky part isn’t what…

Read More

General Build Pipeline (CI) in Azure DevOps

Let’s walk through a general-purpose Azure DevOps build pipeline template that can be applied to most common application types (web apps, APIs, microservices, etc.) using CI/CD best…

Read More

Kubernetes Certifications in 2025: Which One Should You Choose?

Kubernetes Certifications in 2025: Which One Should You Choose? Kubernetes has become the cornerstone of modern cloud-native application deployment and orchestration. Whether you’re a beginner just diving…

Read More

Top 5 Kubernetes Tools That Will Replace Your Bash Scripts in 2025

🚀 Top 5 Kubernetes Tools That Will Replace Your Bash Scripts in 2025 For years, DevOps engineers and platform teams have relied on Bash scripts to automate…

Read More

Kubernetes Horror Stories (and What We Learned From Them)

☠️ Kubernetes Horror Stories (and What We Learned From Them) Because what doesn’t kill your cluster makes it stronger. Kubernetes is powerful — but with great power…

Read More

Why Your Kubernetes Costs Are Out of Control – and How to Fix It (2025 Guide)

💸 Why Your Kubernetes Costs Are Out of Control – and How to Fix It (2025 Guide) Kubernetes is powerful — but it isn’t cheap. While it…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x