FahamLah

Commands

kubectl get

kubectl get <type> [name] [-n ns | -A] [-o wide|yaml|name|jsonpath=…] [-l key=value] [-w]

Risk: Safe

What it does

Lists objects as a table: pods, deployments, services and more.

When to use it

Any time you want to see what exists right now.

Example

$ kubectl get pods

Show my trays and how they are doing.

$ kubectl get pods -o wide

Also show each pod's IP and node.

$ kubectl get deployment shop -o yaml

Show the whole object, spec and status.

$ kubectl get pods -l app=shop

Only pods with the label app=shop.

$ kubectl get pods -A

Pods in every namespace.