PODS
Command | Description |
kubectl | |
kubectl get pods –namespace=dev | Lists pods in that specific namespace |
NAMESPACES
Command | Description |
kubectl get namespaces | |
kubectl config set-context $(kubectl config current-context) –namespace=dev | Switching to another namespace |
DEPLOYMENTS
Command | Description |
kubectl create deployment –image=nginx nginx | |
kubectl expose deployment nginx –port 80 | Creates a service of type CluserIP exposing the port to internal services |
kubectl edit deployment nginx | |
kubectl scale deployment nginx —replicas=5 | |
kubectl set image deployment nginx nginx=nginx:1.18 |
IMPERATIVE COMMANDS
Commands |
kubectl run nginx –image=nginx |
kubectl run nginx –image=nginx –dry-run=client -o yaml |
kubectl create deployment –image=nginx nginx |
kubectl create deployment –image=nginx nginx –dry-run=client -o yaml |
kubectl create deployment nginx –image=nginx –replicas=4 |
kubectl scale deployment nginx –replicas=4 |
kubectl create deployment nginx –image=nginx –dry-run=client -o yaml > nginx-development.yaml |
kubectl expose deployment nginx –port=80 –name nginx-svc –dry-run=client -o yaml |
kubectl expose pod nginx –port=80 –name nginx-service –type=NodePort –dry-run=client -o yaml |
kubectl create service nodeport nginx –tcp=80:80 –node-port=30080 –dry-run=client -o yaml |