Skip to content

Useful Kubernetes commands

This page gives a few example of useful commands.

List running pods

kubectl get pods

list active services

kubectl get pods

list all active resources

kubectl get all

Get more details on a pod

kubectl describe pods <pod-id>

get logs from a pod

kubectl logs <pod-id>

kill a pod

kubectl delete pod <pod-id>

setup port forwarding for a pod

kubectl port-forward pod/<pod-id> <local-port>:<remote-port>

setup port forwarding for a service

kubectl port-forward service/<pod-id> <local-port>:<remote-port>

Raise an issue or comment below