Skip to content

Kubernetes: Context & namespace

3 Kubernetes commands: Context & namespace. Click a command to see what each part does.

Index
3 items
Click a command to see what each part does.

Context & namespace3

  • kubectl config current-contextWhich cluster am I talking to?

    What each part does

    1. kubectl configwork with the kubeconfig file
    2. current-contextprint the active context (cluster + user + default namespace)
  • kubectl config get-contexts; kubectl config use-context <context>List contexts and switch

    What each part does

    1. get-contextsall contexts; * marks the active one
    2. use-context <context>make <context> the default for later commands

    Tip Check twice before running anything against prod.

  • kubectl config set-context --current --namespace=<namespace>Set the default namespace for this context

    What each part does

    1. set-contextedit a context
    2. --currentthe active one
    3. --namespace=<namespace>saved default namespace, so you can drop -n afterwards

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…