My_cheatSheets
Kubernetes Cheat Sheet
Cluster Management
Get cluster information
kubectl cluster-infoView nodes
kubectl get nodes
Workloads
List all pods in all namespaces
kubectl get pods --all-namespacesCreate a pod using an image
kubectl run <pod-name> --image=<image-name>Describe a pod
kubectl describe pod <pod-name>Services & Networking
Create a new service
kubectl expose deployment <deployment-name> --type=<service-type> --port=<port>Get all services in the namespace
kubectl get svcConfiguration
Set a context’s user and cluster
kubectl config set-context --current --user=<user-name> --cluster=<cluster-name>View kubeconfig settings
kubectl config viewMonitoring & Logging
Print the logs for a container in a pod
kubectl logs <pod-name>Stream pod logs in real-time
kubectl logs -f <pod-name>Resource Management
List resource quotas
kubectl get quotaDescribe resource usage on nodes
kubectl top nodes
Last updated
Was this helpful?