Kubernetes Basics Cheatsheet
Quick reference for Kubernetes: pods, deployments, services, configmaps, secrets, storage, networking, and common kubectl commands.
| Item | Description | Example | Category |
|---|---|---|---|
| Pod | Smallest deployable unit, single/multi container | apiVersion: v1 kind: Pod metadata: name: my-pod | Core Concepts |
| Deployment | Manages replica sets and pods | kubectl create deployment nginx --image=nginx | Core Concepts |
| ReplicaSet | Ensures specified number of pod replicas | apiVersion: apps/v1 kind: ReplicaSet | Core Concepts |
| Namespace | Isolate resources | kubectl create namespace dev | Core Concepts |
| Service | Expose pods internally or externally | kubectl expose pod nginx --type=NodePort --port=80 | Resources |
| ConfigMap | Store non-confidential config | kubectl create configmap my-config --from-literal=key=value | Config & Secrets |
| Secret | Store sensitive data | kubectl create secret generic my-secret --from-literal=password=1234 | Config & Secrets |
| Volume | Persistent storage for pods | volumes: - name: data persistentVolumeClaim: claimName: my-pvc | Storage |
| kubectl get | List resources | kubectl get pods | Commands |
| kubectl describe | Detailed info of a resource | kubectl describe pod my-pod | Commands |
| kubectl logs | View pod logs | kubectl logs my-pod | Commands |
| kubectl exec | Execute command inside pod | kubectl exec -it my-pod -- /bin/bash | Commands |
| kubectl apply | Apply configuration file | kubectl apply -f deployment.yaml | Commands |
| kubectl delete | Delete resource | kubectl delete pod my-pod | Commands |
| ClusterIP | Internal service IP | type: ClusterIP | Networking |
| NodePort | Expose service on node port | type: NodePort | Networking |
| LoadBalancer | External load balancer | type: LoadBalancer | Networking |
| PersistentVolume | Cluster storage resource | apiVersion: v1 kind: PersistentVolume | Storage |
| PersistentVolumeClaim | Request storage | apiVersion: v1 kind: PersistentVolumeClaim | Storage |