Kubectl config: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 4: Line 4:
=Overview=
=Overview=


==current-context==
==<tt>current-context</tt>==


Displays the [[.kube_config#Current_Context|current context]]:
Displays the [[.kube_config#Current_Context|current context]]:


kubectl config current-context
<syntaxhighlight lang='bash'>
kubectl config current-context
</syntaxhighlight>


==use-context==
==<tt>use-context</tt>==


Sets the [[.kube_config#Current_Context|current context]]:
Sets the [[.kube_config#Current_Context|current context]]:


kubectl config use-context ''new-context-name''
<syntaxhighlight lang='bash'>
kubectl config use-context <new-context-name>
</syntaxhighlight>


==view==
==<tt>view</tt>==


Displays the content of [[.kube config|~/.kube/cofig]]:
Displays the content of [[.kube config|~/.kube/cofig]]:


kubectl config view
<syntaxhighlight lang='bash'>
kubectl config view
</syntaxhighlight>
 
==<tt>rename-context</tt>==
Renames a context from the .kube/conf file:
<syntaxhighlight lang='bash'>
kubectl config rename-context <old-context-name> <new-context-name>
</syntaxhighlight>
In case the context being updated is the current context, the current context will also be updated.
==<tt>get-contexts</tt>==
==<tt>get-clusters</tt>==
==<tt>delete-cluster</tt>==
<syntaxhighlight lang='bash'>
kubectl config delete-cluster
</syntaxhighlight>
 
==<tt>get-users</tt>==
==<tt>delete-user</tt>==
<syntaxhighlight lang='bash'>
kubectl config delete-user
</syntaxhighlight>

Latest revision as of 00:14, 5 December 2023

Internal

Overview

current-context

Displays the current context:

kubectl config current-context

use-context

Sets the current context:

kubectl config use-context <new-context-name>

view

Displays the content of ~/.kube/cofig:

kubectl config view

rename-context

Renames a context from the .kube/conf file:

kubectl config rename-context <old-context-name> <new-context-name>

In case the context being updated is the current context, the current context will also be updated.

get-contexts

get-clusters

delete-cluster

kubectl config delete-cluster

get-users

delete-user

kubectl config delete-user