Basic Kubernetes commands

Dhruv Saksena
Nov 10, 2021

--

  1. Get all pods in a cluster for a given namespace
kubectl get pod -o wide --namespace=<<namespace-name>>

2. Get all pods for all namespaces

kubectl get pod -o wide --all-namespaces

3. Make a deployment in Kubernetes cluster with deployment file

kubectl apply -f deployment.yaml

4. Redeploy any deployment in a Kubernetes cluster

kubectl rollout restart deployment/<<deployment-name>> -n <<namespace-name>>

5. Get the status of any deployment in a Kubernetes cluster

kubectl rollout status deployment <<deployment-name >>-n <<namespace-name>>

6. Get logs of any pod in Kubernetes

kubectl logs -f <<pod-name>> -n <<namespace-name>>

7. Get inside a pod in Kubernetes

kubectl exec -it <<pod-name>> -n <<namespace-name>> /bin/bash

--

--

No responses yet