Kubernetes-Cheatsheet

๐Ÿ‘‹ Hello Kubernetes # Check kubectl version kubectl version --client # Check cluster nodes kubectl get nodes # Create a namespace kubectl create namespace dev ๐Ÿ’ก Tip: Always set the namespace using kubectl config set-context --current --namespace=dev to avoid deploying to default namespace. ๐Ÿ“ฆ Pods # List all pods kubectl get pods # Describe a pod kubectl describe pod my-pod # Delete a pod kubectl delete pod my-pod ๐Ÿ’ก Tip: Pods are the smallest deployable unit in Kubernetes. They may contain one or more containers. ๐Ÿš€ Deployments # Create a deployment kubectl create deployment nginx-deploy --image=nginx:latest # Scale deployment kubectl scale deployment nginx-deploy --replicas=3 # Update image kubectl set image deployment/nginx-deploy nginx=nginx:1.25 ๐Ÿ’ก Tip: Deployments manage pods and ensure desired state. Use kubectl rollout status deployment/nginx-deploy to track progress. ๐ŸŒ Services # Expose deployment as ClusterIP (default) kubectl expose deployment nginx-deploy --port=80 # Expose…

Post a Comment