如何将 kubectl 配置文件与 ~/.kube/config 合并? [英] How to merge kubectl config file with ~/.kube/config?

查看:35
本文介绍了如何将 kubectl 配置文件与 ~/.kube/config 合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个简单的 kubectl 命令来获取一个 kubeconfig 文件(包含集群+上下文+用户)并将其合并到 ~/.kube/config 文件中作为附加上下文?

Is there a simple kubectl command to take a kubeconfig file (that contains a cluster+context+user) and merge it into the ~/.kube/config file as an additional context?

推荐答案

这样做:

export KUBECONFIG=~/.kube/config:~/someotherconfig 
kubectl config view --flatten

如果需要,您可以将其输出到一个新文件中.

You can then pipe that out to a new file if needed.

这篇关于如何将 kubectl 配置文件与 ~/.kube/config 合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆