Jump to content
Sign in to follow this  
Gerant

Contexts - CKA Kubernetes

Recommended Posts

Can anybody help me to solve below question:

 

You have access to multiple clusters from your main terminal through kubectl contexts. Write all those context names into /opt/course/1/contexts.

Next write a command to display the current context into /opt/course/1/context_default_kubectl.sh, the command should use kubectl.

Finally write a second command doing the same thing into /opt/course/1/context_default_no_kubectl.sh, but without the use of kubectl.

Share this post


Link to post
Share on other sites

1: kubectl config get-contexts -o name > /opt/course/1/contexts

2: kubectl config current-context >  /opt/course/1/context_default_kubectl.sh

3: cat ~/.kube/config | awk '{if(/current-context:/) print $2}' > /opt/course/1/context_default_no_kubectl.sh

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...