CKA 模拟真题 Killer.sh | Question 1 | Contexts
Task weight: 1%
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.
译文
你可以通过 kubectl contexts 从你的主终端访问多个集群。把所有这些上下文的名字写进 /opt/course/1/contexts 。
接下来写一条显示当前环境的命令到 /opt/course/1/context_default_kubectl.sh ,该命令应使用 kubectl 。
最后写第二条命令做同样的事情到 /opt/course/1/context_default_no_kubectl.sh ,但不使用 kubectl 。
解答:
k config get-contexts # copy manually |

kubectl config current-context |

cat ~/.kube/config | grep current | awk '{printf $2}' |

本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
评论



