kubectx 失败的原因是 KUBECONFIG 中有多个文件,目前不支持。

huangapple go评论58阅读模式
英文:

Why kubectx failed? multiple files in KUBECONFIG are currently not supported

问题

我添加了 KUBECONFIG

echo $KUBECONFIG
/home/miki/.kube/config:

当我尝试

kubectx

我收到了

error: kubeconfig error: failed to load: cannot determine kubeconfig path: multiple files in KUBECONFIG are currently not supported

在我的配置文件中,我有 k3s 和 aws 集群。

server: https://127.0.0.1:6443
name: default
server: https://3ECADDEA56D1B423B5D649212BDC10A1.yl4.us-east-1.eks.amazonaws.com
name: arn:aws:eks:us-east-1:57711112222:cluster/pizd-cluster

如何使用 kubectx 避免错误?

英文:

I added KUBECONFIG

echo $KUBECONFIG
/home/miki/.kube/config:

When I try

kubectx

I got

error: kubeconfig error: failed to load: cannot determine kubeconfig path: multiple files in KUBECONFIG are currently not supported

In my config file I have both k3s and aws clusters.

   server: https://127.0.0.1:6443
  name: default
 server: https://3ECADDEA56D1B423B5D649212BDC10A1.yl4.us-east-1.eks.amazonaws.com
  name: arn:aws:eks:us-east-1:57711112222:cluster/pizd-cluster

How to use kubectx to avoid error?

答案1

得分: 1

我已经使用单独的文件配置了这个,每个集群都有一个单独的文件,所以我用所有文件分隔开的方式设置了KUBECONFIG变量,用两个冒号":"分隔。

> echo $KUBECONFIG
'/home/user/cluster1.config:/home/user/cluster2.config:/home/user/cluster3.config'

每个文件都有自己的配置,对我来说都可以正常工作。

英文:

i've configured this using a individual file for each individual cluster, so i set the KUBECONFIG var with all files separated by two points ":"

> echo $KUBECONFIG 
'/home/user/cluster1.config:/home/user/cluster2.config:/home/user/cluster3.config'

each file with your own configuration, its works finelly to me.

huangapple
  • 本文由 发表于 2023年6月5日 13:23:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76403666.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定