Kubernetes Cheat Sheet

Basic Commands

CommandDescription
kubectl get podsList all pods
kubectl get deploymentsList all deployments
kubectl get servicesList all services
kubectl describe pod <pod_name>Describe a pod
kubectl describe deployment <deployment_name>Describe a deployment
kubectl describe service <service_name>Describe a service
kubectl apply -f <file>.yamlApply a YAML or JSON file
kubectl delete pod <pod_name>Delete a pod
kubectl delete deployment <deployment_name>Delete a deployment
kubectl delete service <service_name>Delete a service
kubectl logs <pod_name>View the logs for a pod
kubectl exec -it <pod_name> -- /bin/bashOpen a shell inside a running container

Resources

ResourceDescription
PodThe smallest deployable unit in Kubernetes
DeploymentA controller for managing and scaling pods
ServiceA way to expose pods to the network
IngressA way to route external traffic to services
ConfigMapA configuration store for non-sensitive data
SecretA configuration store for sensitive data
VolumeA way to store data and share it between containers

YAML Configuration

SectionDescription
apiVersion:The API version of the resource
kind:The type of resource (pod, deployment, service, etc.)
metadata:Metadata about the resource (name, labels, etc.)
spec:The specification for the resource (containers, volumes, etc.)
status:The current status of the resource

Leave a Reply

Proudly powered by WordPress | Theme: Code Blog by Crimson Themes.