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

Kubernetes Command Cheat Sheet

Cheat engine

Uploaded by

harshaltapadiya
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)
9 views2 pages

Kubernetes Command Cheat Sheet

Cheat engine

Uploaded by

harshaltapadiya
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 COMMAND CHEAT SHEET

== Basic Cluster Info ==


kubectl cluster-info # Show cluster info
kubectl get nodes # List all nodes
kubectl get pods -A # List all pods in all namespaces

== Namespace ==
kubectl get ns # List namespaces
kubectl create ns <name> # Create namespace
kubectl delete ns <name> # Delete namespace

== Pod Management ==
kubectl get pods # List pods
kubectl describe pod <pod-name> # Describe pod
kubectl logs <pod-name> # View pod logs
kubectl exec -it <pod-name> -- /bin/bash # Access pod shell

== Deployments ==
kubectl create deployment <name> --image=nginx
kubectl get deployments
kubectl describe deployment <name>
kubectl rollout status deployment <name>
kubectl delete deployment <name>

== Services ==
kubectl expose deployment <name> --type=NodePort --port=80
kubectl get svc
kubectl describe svc <name>

== ConfigMaps & Secrets ==


kubectl create configmap my-config --from-literal=key=value
kubectl get configmap my-config -o yaml

kubectl create secret generic my-secret --from-literal=password=1234


kubectl get secrets
kubectl describe secret my-secret

== RBAC ==
kubectl create role <name> --verb=get,list --resource=pods
kubectl create rolebinding <name> --role=<name> --user=<user> --namespace=<ns>

== Persistent Volumes ==
kubectl get pv
kubectl get pvc
kubectl describe pvc <name>

== Taints & Tolerations ==


kubectl taint nodes <node-name> key=value:NoSchedule
kubectl describe node <node-name> | grep -i taint

== Helm ==
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/nginx
helm upgrade my-release bitnami/nginx
helm uninstall my-release

== Logs & Debug ==


kubectl logs <pod-name>
kubectl get events --sort-by='.metadata.creationTimestamp'
kubectl top pod

== Apply/Delete Manifests ==
kubectl apply -f <file.yaml>
kubectl delete -f <file.yaml>
kubectl diff -f <file.yaml>

== Scaling ==
kubectl scale deployment <name> --replicas=5
kubectl autoscale deployment <name> --min=1 --max=10 --cpu-percent=80

== Resources ==
kubectl get all
kubectl describe <resource> <name>
kubectl edit <resource> <name>

You might also like