k8s

Get all namespaces:

kubectl get ns
#=> returns all the namespaces

Get all resources:

kubectl get all
#=> returns all the resources under default namespace
kubectl get pods -n yourawesomenamespace
#=> returns all the resources under yourawesomenamespace

Get pods:

kubectl get pods
#=> returns all the pods under default namespace
kubectl get pods -n yourawesomenamespace
#=> returns all the pods under yourawesomenamespace

K8s contexts:

kubectl config get-contexts
#=> returns all the available clusters
kubectl config use-context yourawesomecontext
#=> switches to yourawesomecontext
kubectl config set-context yourawesomecontext --namespace=yourawesomenamespace
# modifies context to use yourawesomenamespace as default namespace

K8s port forward:

kubectl port-forward podname-43cc3323f -n yourawesomenamespace 5000:5000
#=> here podname-43cc3323f is a sample pod name. Left side of the port number (5000)
#=> exposes local machine port number, right side port number belongs to podname-43cc3323f

k8s describe pods:

kubectl describe pods podname-43cc3323f -n yourawesomenamespace
#=> here podname-43cc3323f is a sample pod name.

k8s pod logs:

kubectl logs podname-43cc3323f -n yourawesomenamespace
#=> here podname-43cc3323f is a sample pod name.

k8s get ingress:

kubectl get ing -n yourawesomenamespace
#=> here podname-43cc3323f is a sample pod name.