skip to content
Alvin Lucillo

Kubectl Config Commands

/ 1 min read

💻 Tech

Here are some of kubectl commands related to config that I found useful:

  • kubectl config view - View the current kubeconfig file
  • kubectl config use-context --current --namespace ns1 - Set the current namespace ns1 for the current context
  • kubectl config set-credentials marv --client-certificate=/root/marv.crt - Set the client certificate for an existing user marv
  • kubectl config set-context developer --user=martin --cluster=kubernetes - Create a new context developer with user marv and cluster kubernetes

If you want to verify if a user has access to perform an action on a resource, you can use this: kubectl auth can-i list pods --as=marv -n development