舵和kubectl上下文不匹配 [英] helm and kubectl context mismatch
问题描述
我无法理解helm
对helm --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:
-
检查
~/.kube/config
-
kubectl config view
current-context
是否设置为:microk8s?
Is current-context
set to: microk8s?
-
尝试使用:
Try to use:
-
kubectl config get-contexts
kubectl config set-context
kubectl config use-context
具有适当的参数--server
--user
--cluster
-
检查是否引用的是
~/.kube/config
的配置,而不是其他地方的私有配置.
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屋!