current-context: "fralychen" # 当前正在使用的上下文名称、表示kubectl连接的集群为fralychen 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 配置对多集群的访问 在将集群、用户和上下文定义在一个或多个配置文件中之后,用户可以使用kubectl config use-context命令快...
(5)kubectl config get-context:获取所有的context kubernetes中context类似“用户”的意思,这是多租户使用的的前提。 root@VM-16-6-ubuntu:~#kubectl config current-contextkubernetes-admin@kubernetes (6)kubectl config set-context:添加一个context root@VM-16-6-ubuntu:~#kubectl config set-context admin1@k8...
get-context 描述一个或多个上下文 rename-context 从kubeconfig文件重命名上下文。 set 在kubeconfig文件中设置一个单独的值 set-cluster 在kubeconfig中设置一个集群条目 set-context 在kubeconfig中设置一个上下文条目 set-credentials 在kubeconfig中设置一个用户条目 unset 取消设置kubeconfig文件中的单个值 use-cont...
kubectl --kubeconfig=config config unset contexts.sit 测试一下 默认context连接的集群 指定一下context kubectl --context sit get nodes 就可以连接sit集群了。 还是不太方便,每次都要--context。可以把sit设置为默认连接 kubectl config use-context sit 现在,current-context就是sit环境了 好了。以后就方便了~...
current-context 显示当前contexts delete-cluster 从kubeconfig中刪除指定的集群 delete-context 从kubeconfig中刪除指定的上下文 get-clusters 显示kubeconfig中定义的集群 get-contexts 描述一个或多个contexts rename-context 在kubeconfig中给一个context改名 set 在kubeconfig中设置单个值 set-cluster 在kubeconfig中设置...
查看当前配置的上下文列表:kubectl config get-contexts 设置要使用的上下文:kubectl config use-context <context-name> 确认当前上下文:kubectl config current-context 使用kubectl命令对特定上下文运行命令。 腾讯云提供了腾讯云容器服务 TKE,可以帮助用户轻松管理和运行Kubernetes集群。您可以通过以下链接了解更多关于腾讯云容...
kubectl config get-contexts# 显示上下文列表 kubectl config current-context# 展示当前所处的上下文 kubectl config use-context my-cluster-name# 设置默认的上下文为 my-cluster-name # 添加新的用户配置到 kubeconf 中,使用 basic auth 进行身份认证
kubectl get namespaces # 列出所有命名空间kubectl create namespace <name> # 创建新的命名空间kubectl config set-context --current --namespace=<name> # 设置当前命名空间 通过命名空间,用户可以轻松管理多个项目或应用程序的资源。4.2 资源标签与选择器 标签和选择器是 Kubernetes 中强大的功能,...
kube/kubconfig2 kubectl config view# 获取 e2e 用户的密码$ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'# 显示当前的上下文$ kubectl config current-context # 设置默认上下文为 my-cluster-name$ kubectl config use-context my-cluster-name # 向 kubeconf 中增加...
选择默认上下文 [root@k8smaster ~]# kubectl config use-context default --kubeconfig=bootstrap.kubeconfig Switched to context “default”. kubectl config 设置别名 # Get current context alias krc='kubectl config current-context' # List all contexts alias klc='kubectl config get-contexts -o name ...