Skip to content

Kubernetes Commands

Links: 110 Kubernetes Index


Listing things

  • kubectl get node
  • kubectl get node -o wide: more info
  • kubectl get node -o yaml: a lot of info in yaml format, we can also get it in json format.
We can use jq to get specific information from the nodes
kubectl get nodes -o json | jq ".items[] | {name:.metadata.name} + .status.capacity"
  • We can list all available resource types by runningĀ kubectl get
  • kubectl get all: get all the services

Describing things

  • kubectl describe type/name
  • kubectl explain type: to view the definition of a resource type

Running commands

  • kubectl exec busybox nslookup kubernetes.default: run commands in containers
  • kubectl exec -it busybox /bin/sh: getting into the pods

Last updated: 2022-09-05