====== Kubernetes Commands Cheat Sheet ====== ===== Basic Commands ===== kubectl version - Check Kubernetes version kubectl cluster-info - Display cluster information kubectl get nodes - List all nodes in the cluster kubectl get pods - List all running pods ===== Pod Management ===== kubectl run POD_NAME --image=IMAGE - Create and run a pod with an image kubectl get pods - List all pods kubectl delete pod POD_NAME - Delete a pod kubectl logs POD_NAME - View logs of a pod kubectl exec -it POD_NAME -- COMMAND - Run a command inside a running pod ===== Deployment Management ===== kubectl create deployment DEPLOYMENT_NAME --image=IMAGE - Create a deployment kubectl get deployments - List deployments kubectl delete deployment DEPLOYMENT_NAME - Delete a deployment kubectl scale deployment DEPLOYMENT_NAME --replicas=N - Scale a deployment kubectl rollout status deployment DEPLOYMENT_NAME - Check deployment rollout status ===== Service Management ===== kubectl expose deployment DEPLOYMENT_NAME --type=LoadBalancer --port=PORT - Expose a deployment as a service kubectl get services - List services kubectl delete service SERVICE_NAME - Delete a service ===== Namespace Management ===== kubectl get namespaces - List all namespaces kubectl create namespace NAMESPACE_NAME - Create a namespace kubectl delete namespace NAMESPACE_NAME - Delete a namespace ===== ConfigMap & Secret Management ===== kubectl create configmap CONFIGMAP_NAME --from-literal=KEY=VALUE - Create a ConfigMap kubectl get configmaps - List ConfigMaps kubectl delete configmap CONFIGMAP_NAME - Delete a ConfigMap kubectl create secret generic SECRET_NAME --from-literal=KEY=VALUE - Create a Secret kubectl get secrets - List Secrets kubectl delete secret SECRET_NAME - Delete a Secret ===== Additional Useful Commands ===== kubectl describe RESOURCE_NAME RESOURCE_INSTANCE - Show detailed information about a resource kubectl get all - List all resources in the cluster kubectl apply -f FILE - Apply a configuration file kubectl delete -f FILE - Delete resources from a file kubectl top pod - Show resource usage of pods This cheat sheet provides an overview of commonly used Kubernetes commands. For more details, refer to the Kubernetes Documentation.