问题
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.
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.
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.
Why can't helm use obviously present contexts?
回答1:
This looks like a kubernetes configuration problem more than an issue with helm itself.
There are few things that might help:
Check the config file in
~/.kube/configkubectl config view
Is current-context set to: microk8s?
Try to use:
kubectl config get-contextskubectl config set-contextkubectl config use-context
with proper arguments --server --user --cluster
Check if you are refering to the config from
~/.kube/configand not your own private config from somewhere else.Check if you have a
KUBECONFIGenvironment variable (echo $KUBECONFIG)
I hope it helps.
来源:https://stackoverflow.com/questions/56570319/helm-and-kubectl-context-mismatch