Kubernetes Up & Running: Chapter 4

Common kubectl commands

Namespace and Contexts

kubectl config set-context my-context --namespace=mystuff

kubectl config use-context my-context


Note: to list namespaces, see Kubernetes: Namespaces


Page 34

kubectl get pods

Note -o wide gives more information.

kubectl describe pod <pod id>


Page 35

kubectl label pods <pod id> color=green

Show labels:

kubectl get pods --show-labels

Remove label:

kubectl label pods bar color-

Note: the command in the book does not work:

kubectl label pods bar -color


unknown shorthand flag: 'c' in -color



Copy-and-paste: https://github.com/rusrushal13/Kubernetes-Up-and-Running/blob/master/Chapter4.md

Leave a Reply

Your email address will not be published. Required fields are marked *