Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views2 pages

Kubernetes Commands Guide

Kubernetes_Commands_Guide

Uploaded by

Deyvessh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Kubernetes Commands Guide

Kubernetes_Commands_Guide

Uploaded by

Deyvessh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Kubernetes Commands: Basic -> Intermediate -> Advanced

1. Basic Commands (For Starters / Day-to-Day Operations)


- kubectl version --short: Check client & server version
- kubectl cluster-info: Show cluster details
- kubectl get nodes: List all nodes in the cluster
- kubectl get pods: List pods in default namespace
- kubectl get pods -A: List pods across all namespaces
- kubectl describe pod <pod_name>: Detailed info about a pod
- kubectl logs <pod_name>: View logs of a pod
- kubectl exec -it <pod_name> -- bash: Open interactive shell inside pod
- kubectl create -f <file>.yaml: Create resource from YAML file
- kubectl delete pod <pod_name>: Delete a pod

2. Intermediate Commands (For Developers & CI/CD)


- kubectl get deployments: List deployments
- kubectl create deployment <name> --image=<img>: Quick deployment
- kubectl expose deployment <name> --type=NodePort --port=80: Expose deployment as service
- kubectl get svc: List services
- kubectl scale deployment <name> --replicas=3: Scale deployment pods
- kubectl rollout status deployment/<name>: Check rollout status
- kubectl rollout undo deployment/<name>: Rollback deployment
- kubectl config view: View kubeconfig file
- kubectl config use-context <cluster>: Switch context between clusters
- kubectl get namespaces: List namespaces
- kubectl create namespace dev: Create namespace
- kubectl get pods -n <namespace>: Get pods from a namespace

3. Advanced Commands (For DevOps / Production / Troubleshooting)


- kubectl top pod: Show pod resource usage (CPU/Memory)
- kubectl top node: Show node resource usage
- kubectl get events: List cluster events (for debugging)
- kubectl drain <node>: Safely evict pods before maintenance
- kubectl cordon <node>: Mark node unschedulable
- kubectl uncordon <node>: Mark node schedulable again
- kubectl taint nodes <node> key=value:NoSchedule: Prevent pods from scheduling on node
- kubectl apply -f <file>.yaml: Update config without deleting
- kubectl edit deployment <name>: Edit live deployment
- kubectl port-forward pod/<pod> 8080:80: Access pod locally
- kubectl api-resources: Show all available resource types
- kubectl get all -n <namespace>: Show all resources in namespace
- kubectl debug: Start ephemeral container for debugging

You might also like