舵和kubectl上下文不匹配 [英] helm and kubectl context mismatch

查看:188
本文介绍了舵和kubectl上下文不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解helmhelm --kube-context=microk8s install ...的使用应该安装在上下文microk8s中,因此安装在我的本地microk8s群集中,而不是我曾经连接过的远程GKE群集中.

I'm having trouble understanding helm's use of helm --kube-context=microk8s install ... should install into the context microk8s thus into my local microk8s cluster rather than the remote GKE cluster which I once connected to.

但是如果我运行例如,这会由于Error: could not get Kubernetes config for context "microk8s": context "microk8s" does not exist而失败helm --kube-context=microk8s install --name mereet-kafka成功运行helm init并添加必要的存储库后.

This however fails due to Error: could not get Kubernetes config for context "microk8s": context "microk8s" does not exist if I run e.g. helm --kube-context=microk8s install --name mereet-kafka after successfully running helm init and adding necessary repositories.

存在上下文microk8s并根据kubectl config current-context启用了上下文.我什至可以通过运行helm --kube-context=$(kubectl config current-context) install --name mereet-kafka来重现此代码,以避免出现任何错字.

The context microk8s is present and enabled according to kubectl config current-context. I can even reproduce this by running helm --kube-context=$(kubectl config current-context) install --name mereet-kafka in order to avoid any typos.

为什么helm不能使用明显存在的上下文?

Why can't helm use obviously present contexts?

推荐答案

这看起来像kubernetes的配置问题,而不是掌舵本身的问题.

This looks like a kubernetes configuration problem more than an issue with helm itself.

以下几件事可能会有所帮助:

There are few things that might help:

  1. 检查~/.kube/config

  • kubectl config view

current-context是否设置为:microk8s?

Is current-context set to: microk8s?

  1. 尝试使用:

  1. Try to use:

  • kubectl config get-contexts

kubectl config set-context

kubectl config use-context

具有适当的参数--server --user --cluster

  1. 检查是否引用的是~/.kube/config的配置,而不是其他地方的私有配置.

  1. Check if you are refering to the config from ~/.kube/config and not your own private config from somewhere else.

检查是否有KUBECONFIG环境变量(echo $KUBECONFIG)

Check if you have a KUBECONFIG environment variable (echo $KUBECONFIG)

希望对您有帮助.

这篇关于舵和kubectl上下文不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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