If you’re working with Kubernetes, learning kubectl is a must.
Here are 10 practical commands to help you manage your cluster more easily


kubectl get pods

Show all pods in the current namespace.

kubectl get pods

kubectl get all

Returns all resources: pods, services, deployments, and more.

kubectl get all

kubectl logs

Check the logs of your application inside a pod.

kubectl logs my-pod

kubectl describe pod

See full details about a pod — useful for debugging.

kubectl describe pod my-pod

kubectl exec -it -- bash

Access the pod with a terminal session.

kubectl exec -it my-pod -- bash

kubectl delete pod

Delete a pod (if it’s part of a deployment, it will restart automatically).

kubectl delete pod my-pod

kubectl apply -f file.yaml

Create or update resources using a YAML file.

kubectl apply -f deployment.yaml

kubectl get services

List all services with their IPs and ports.

kubectl get svc

kubectl get nodes

Show all nodes in your Kubernetes cluster.

kubectl get nodes

kubectl config use-context

Switch between clusters or environments.

kubectl config use-context minikube

Bonus tip: Use kubectl explain to explore any resource directly in your terminal.