Kubectx and kubens are two tools to be added to kubectl to manage multiple clusters/contexts and namespaces.
Installation on MacOS:
brew install kubectx
Kubectx.
Helps you switch between clusters in a fast way:
Show the list of contexts of your .kube/config:
Set the context for all subsequent commands:
Switch to the previous context
Show the current context name:
Rename context k8s-context2 to k8s2:
Rename current-context to k8s2:
Delete context k8s-context3:
Kubens.
Allows you to easily switch between Kubernetes namespaces.
List the namespaces in the current context:
Change the active namespace of current context:
Switch to the previous namespace in this context:
Show the current namespace:
Helps you switch between clusters in a fast way:
Show the list of contexts of your .kube/config:
kubectx
k8s-context1
k8s-context2
k8s-context3
Set the context for all subsequent commands:
kubectx k8s-context2
Switch to the previous context
kubectx -
Show the current context name:
kubectx -c
Rename context k8s-context2 to k8s2:
kubectx k8s2=k8s-context2
Rename current-context to k8s2:
kubectx k8s2=.
Delete context k8s-context3:
kubectx -d k8s-context3
Kubens.
Allows you to easily switch between Kubernetes namespaces.
List the namespaces in the current context:
kubens
application-system-prod
application-system-dev
ci-cd
concourse-cicd-main
default
Change the active namespace of current context:
kubens ci-cd
Switch to the previous namespace in this context:
kubens -
Show the current namespace:
kubens -c
No comments:
Post a Comment