Cheatsheet: kubectl
Basic Commands
Show cluster info
List all resources in the cluster
List all pods in the current namespace
List all resources of a type
Describe a resource
Get resource in a specific namespace
Create resource from file
Delete a resource
Pod Management
Get logs for a pod
Get logs for a specific container in a pod
Execute a command in a pod
Port-forward a pod to localhost
Delete a pod
Deployment Management
List deployments
Scale a deployment
Update deployment image
Roll back a deployment
View rollout status
Namespace & Context
List namespaces
Change current namespace
List contexts
Switch context
Advanced & Troubleshooting
Apply changes to all resources in a directory
Get resources by label selector
Explain a resource type
View events in a namespace
View resource YAML/JSON output