Kubernetes Basics Cheatsheet

Quick reference for Kubernetes: pods, deployments, services, configmaps, secrets, storage, networking, and common kubectl commands.

ItemDescriptionExampleCategory
PodSmallest deployable unit, single/multi containerapiVersion: v1 kind: Pod metadata: name: my-podCore Concepts
DeploymentManages replica sets and podskubectl create deployment nginx --image=nginxCore Concepts
ReplicaSetEnsures specified number of pod replicasapiVersion: apps/v1 kind: ReplicaSetCore Concepts
NamespaceIsolate resourceskubectl create namespace devCore Concepts
ServiceExpose pods internally or externallykubectl expose pod nginx --type=NodePort --port=80Resources
ConfigMapStore non-confidential configkubectl create configmap my-config --from-literal=key=valueConfig & Secrets
SecretStore sensitive datakubectl create secret generic my-secret --from-literal=password=1234Config & Secrets
VolumePersistent storage for podsvolumes: - name: data persistentVolumeClaim: claimName: my-pvcStorage
kubectl getList resourceskubectl get podsCommands
kubectl describeDetailed info of a resourcekubectl describe pod my-podCommands
kubectl logsView pod logskubectl logs my-podCommands
kubectl execExecute command inside podkubectl exec -it my-pod -- /bin/bashCommands
kubectl applyApply configuration filekubectl apply -f deployment.yamlCommands
kubectl deleteDelete resourcekubectl delete pod my-podCommands
ClusterIPInternal service IPtype: ClusterIPNetworking
NodePortExpose service on node porttype: NodePortNetworking
LoadBalancerExternal load balancertype: LoadBalancerNetworking
PersistentVolumeCluster storage resourceapiVersion: v1 kind: PersistentVolumeStorage
PersistentVolumeClaimRequest storageapiVersion: v1 kind: PersistentVolumeClaimStorage