Set default namespace for context

Avoid typing -n on every command for this context

kubectl config set-context --current --namespace=<ns>

tool
kubectl73 commands
tags
config

More kubectl commands

  • kubectl cluster-info

    Show API server and CoreDNS endpoints

  • kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{": "}{range .status.conditions[*]}{.type}={.status},{" "}{end}{"\n"}{end}'

    Show all conditions per node (Ready, MemoryPressure, DiskPressure)

  • kubectl create job --from=cronjob/<name> manual-run -n <ns>

    Immediately run a CronJob as a one-off Job

  • kubectl wait pod -l app=<label> -n <ns> --for=condition=Ready --timeout=120s

    Block until matching pods are Ready or timeout

  • kubectl get --raw /metrics | grep apiserver_request_total

    Pull raw Prometheus metrics from the apiserver without a metrics stack

all 73 kubectl commands