1️⃣ Cluster Commands

CommandDescription
kubectl cluster-infoDisplays cluster information
kubectl get nodes -o wideLists all nodes with additional details

2️⃣ Pod Commands

CommandDescription
kubectl get podsLists all pods
kubectl get pods -o wideShows pods with additional details
kubectl get pods -l <label>=<value>Lists pods with a specific label
kubectl get pod <name>Shows information about a specific pod
kubectl describe pod <name>Displays detailed pod information
kubectl logs <pod>Shows pod logs
kubectl exec -it <pod>Executes a command inside a pod
kubectl delete pod <pod>Deletes a pod
kubectl explain pod <resource>Displays pod resource documentation

3️⃣ Deployment Commands

CommandDescription
kubectl create deployment <name> --image=<image>Creates a deployment
kubectl get deploymentsLists all deployments
kubectl describe deployment <name>Shows deployment details
kubectl scale deployment <name> --replicas=<number>Scales deployment replicas
kubectl rollout restart deployment/<name>Restarts a deployment
kubectl rollout status deployment/<name>Shows rollout status

4️⃣ Service Commands

CommandDescription
kubectl get servicesLists all services
kubectl describe service <name>Shows service details
kubectl expose pod <name>Exposes a pod as a service
kubectl delete service <name>Deletes a service
kubectl port-forward <pod> <local-port>:<remote-port>Forwards local port to a pod

5️⃣ ConfigMap & Secret Commands

CommandDescription
kubectl create configmap <name> --from-literal=<key>=<value>Creates a ConfigMap
kubectl create secret generic <name> --from-literal=<key>=<value>Creates a Secret
kubectl get configmapsLists all ConfigMaps
kubectl get secretsLists all Secrets
kubectl describe configmap <name>Shows ConfigMap details

6️⃣ Namespace Commands

CommandDescription
kubectl get namespacesLists all namespaces
kubectl create namespace <name>Creates a namespace
kubectl delete namespace <name>Deletes a namespace
kubectl config set-context --current --namespace=<name>Switches namespace

7️⃣ Resource Commands

CommandDescription
kubectl apply -f <file>Applies a configuration file
kubectl edit <type> <name>Edits a resource
kubectl delete -f <file>Deletes resources from a file
kubectl get <type>Lists resources of a type
kubectl describe <type> <name>Shows resource details

8️⃣ Statistics & Events Commands

CommandDescription
kubectl top nodesShows node resource usage
kubectl top podsShows pod resource usage
kubectl eventsShows cluster events
kubectl get eventsLists cluster events

9️⃣ Permission Commands

CommandDescription
kubectl get rolesLists roles in the namespace