Kubernetes Complete Reference
A 10-page reference for Kubernetes operators, developers, and SREs.
Chapter 1: Core kubectl Commands
Command Description
kubectl get pods -A List all pods in all namespaces
kubectl get nodes List cluster nodes
kubectl describe pod <name> Detailed pod info
kubectl logs <pod> -f Stream pod logs
kubectl logs <pod> -c <container> Logs from specific container
kubectl exec -it <pod> -- bash Shell into a pod
kubectl apply -f [Link] Apply a manifest
kubectl delete -f [Link] Delete resources from manifest
kubectl diff -f [Link] Preview changes before apply
kubectl rollout status deploy/x Check rollout status
kubectl rollout undo deploy/x Rollback a deployment
kubectl scale deploy/x --replicas=3 Scale a deployment
kubectl port-forward svc/x 8080:80 Port-forward a service
Chapter 2: Namespaces & Contexts
Command Description
kubectl get ns List namespaces
kubectl create ns dev Create namespace
kubectl config get-contexts List kubeconfig contexts
kubectl config use-context prod Switch context
kubectl config current-context Show current context
kubectl config set-context --current --namespace=dev Set default namespace
kubectx <context> Switch context (plugin)
kubens <namespace> Switch namespace (plugin)
Chapter 2b: Resource Types Overview
Resource Abbr. Purpose
Pod po Smallest deployable unit
Deployment deploy Manages ReplicaSets & rolling updates
StatefulSet sts Stateful apps with stable IDs
DaemonSet ds One pod per node
Job job Run-to-completion tasks
CronJob cj Scheduled jobs
Service svc Stable network endpoint
Ingress ing HTTP/S routing
ConfigMap cm Non-secret config
Secret - Sensitive config (base64)
PVC pvc Storage request
HPA hpa Auto-scale on CPU/memory
Chapter 3: Pod Design & Lifecycle
Pod Phases
Phase Description
Pending Pod accepted but containers not yet created. Waiting for scheduler or image pull.
Running At least one container is running or starting/restarting.
Succeeded All containers terminated with exit code 0.
Failed At least one container terminated with non-zero exit code.
Unknown Pod state cannot be determined (usually node communication issue).
Container States
State Description
Waiting Not yet running. Reason: ContainerCreating, ImagePullBackOff, etc.
Running Container executing normally.
Terminated Container finished or crashed. Check exit code.
Common Crash Reasons
Reason Cause & Fix
CrashLoopBackOff App exits immediately. Check logs with kubectl logs.
OOMKilled Exceeded memory limit. Increase [Link].
ImagePullBackOff Image not found or no pull secret. Check image name/tag.
Pending (no nodes) Insufficient resources or taint/toleration mismatch.
Chapter 4: Services & Networking
Service Type Description Use Case
ClusterIP Internal cluster IP only Inter-service communication
NodePort Exposes on each node's IP:port Dev/testing access
LoadBalancer Cloud LB provisioned Production external access
ExternalName CNAME alias to external DNS Bridging external services
Headless No cluster IP, DNS per pod StatefulSet, direct pod DNS
Ingress Annotations (NGINX)
Annotation Purpose
[Link]/rewrite-target URL rewrite rule
[Link]/ssl-redirect Force HTTPS redirect
[Link]/proxy-body-size Max upload size
[Link]/rate-limit Rate limiting
[Link]/whitelist-source-range IP allowlist
Network Policies
Network Policies restrict pod-to-pod communication. Key concepts: podSelector selects target pods;
ingress/egress rules define allowed traffic; an empty podSelector matches all pods in the namespace.
Chapter 5: Storage
Concept Description
PersistentVolume (PV) Cluster-level storage resource provisioned by admin
PersistentVolumeClaim (PVC) User request for storage (size, access mode)
StorageClass Dynamic provisioner config (AWS EBS, GCE PD, NFS)
VolumeMount Mount a volume into a container path
emptyDir Ephemeral volume, lives with the pod
hostPath Mount node filesystem path into pod
ConfigMap volume Mount ConfigMap keys as files
Secret volume Mount Secret keys as files (in-memory tmpfs)
Access Modes
Mode Short Description
ReadWriteOnce RWO Mounted read-write by a single node
ReadOnlyMany ROX Mounted read-only by many nodes
ReadWriteMany RWX Mounted read-write by many nodes
ReadWriteOncePod RWOP Mounted by a single pod only (K8s 1.22+)
Chapter 6: Resource Management & HPA
Every container should define resource requests and limits to ensure stable scheduling and prevent
noisy-neighbor issues.
Field Description Example
[Link] Guaranteed CPU for scheduling 250m (0.25 cores)
[Link] Guaranteed memory 256Mi
[Link] CPU cap (throttled if exceeded) 500m
[Link] Memory cap (OOMKilled if exceeded) 512Mi
QoS Classes
Class Condition Eviction Priority
Guaranteed requests == limits for all containers Last to evict
Burstable requests < limits for at least one Middle priority
BestEffort No requests or limits set First to evict
HPA Configuration Reference
Field Description
minReplicas Minimum number of replicas
maxReplicas Maximum number of replicas
targetCPUUtilizationPercentage Scale out when CPU exceeds this %
[Link] Cooldown before scaling up
[Link] Cooldown before scaling down (default 300s)
Chapter 7: Probes & Health Checks
Probe Purpose Failure Action
livenessProbe Is the container alive? Restart container
readinessProbe Is the container ready for traffic? Remove from Service endpoints
startupProbe Has the container started? (slow apps) Restart if startup threshold hit
Probe Types
Type How it works
httpGet HTTP GET request; success if 200-399 returned
tcpSocket TCP connection attempt; success if port open
exec Runs command inside container; success if exit code 0
grpc gRPC Health Check Protocol (K8s 1.24+)
Key Probe Parameters
Parameter Description Default
initialDelaySeconds Wait before first probe 0
periodSeconds How often to probe 10
timeoutSeconds Probe timeout 1
failureThreshold Failures before action 3
successThreshold Successes to consider healthy 1
Chapter 8: RBAC
Role-Based Access Control (RBAC) governs what users and service accounts can do in a cluster.
Object Scope Description
Role Namespace Grants permissions within a namespace
ClusterRole Cluster-wide Grants permissions across all namespaces
RoleBinding Namespace Binds a Role to a user/group/SA
ClusterRoleBinding Cluster-wide Binds a ClusterRole cluster-wide
ServiceAccount Namespace Identity for pods to call the API
Common RBAC Verbs
Verb Description
get Read a single resource
list Read a collection
watch Stream changes
create Create a resource
update Modify an existing resource (full replace)
patch Partially modify a resource
delete Delete a resource
deletecollection Delete multiple resources
Chapter 9: Helm Package Manager
Command Description
helm repo add stable [Link] Add a chart repository
helm repo update Fetch latest chart index
helm search repo nginx Search for charts
helm install myapp ./chart Install a release
helm install myapp ./chart -f [Link] Install with custom values
helm upgrade myapp ./chart Upgrade a release
helm rollback myapp 1 Rollback to revision 1
helm list List releases
helm status myapp Release status
helm uninstall myapp Delete a release
helm template ./chart Render templates locally
helm lint ./chart Validate chart structure
helm package ./chart Package chart as .tgz
Chapter 10: Troubleshooting & Debugging
Scenario Commands to Run
Pod stuck in Pending kubectl describe pod — check Events for scheduler errors, resource limits, taint issues
Pod in CrashLoopBackOff kubectl logs <pod> --previous; check exit code in describe
Service not reachable kubectl get endpoints; verify selector matches pod labels
Image pull failure kubectl describe pod; check imagePullSecrets and registry access
Node NotReady kubectl describe node; check kubelet and container runtime status
PVC stuck in Pending kubectl describe pvc; check StorageClass and provisioner logs
High CPU/Memory kubectl top pods -A; check HPA and resource limits
Network policy blocking traffic kubectl describe networkpolicy; test with temporary allow-all policy
Debugging Toolkit
Tool Purpose
kubectl debug Ephemeral debug container in pod
kubectl run tmp --image=busybox -it Temporary
--rm debug pod
stern <pod-name> Multi-pod log tailing (plugin)
k9s Terminal-based cluster UI
kube-capacity Node/pod resource summary