Get all pods

04-11-2023, source: self

kubectl get pods -o wide -n dev
  • -o TYPE specifies an output type. wide expands the table by more information. Other options are json, yaml, etc.

  • -n NAMESPACE specifies a name of the namespace.

Contexts and Namespaces

Get the current namespace

04-11-2023, source: StackOverflow

kubectl config view --output 'jsonpath={.contexts[?(@.name=="'$(kubectl config current-context)'")].context.namespace}';echo