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 podskubectl get all
Returns all resources: pods, services, deployments, and more.
kubectl get allkubectl logs
Check the logs of your application inside a pod.
kubectl logs my-podkubectl describe pod
See full details about a pod — useful for debugging.
kubectl describe pod my-podkubectl exec -it -- bash
Access the pod with a terminal session.
kubectl exec -it my-pod -- bashkubectl delete pod
Delete a pod (if it’s part of a deployment, it will restart automatically).
kubectl delete pod my-podkubectl apply -f file.yaml
Create or update resources using a YAML file.
kubectl apply -f deployment.yamlkubectl get services
List all services with their IPs and ports.
kubectl get svckubectl get nodes
Show all nodes in your Kubernetes cluster.
kubectl get nodeskubectl config use-context
Switch between clusters or environments.
kubectl config use-context minikubeBonus tip: Use kubectl explain to explore any resource directly in your terminal.