我已经使用kops启动了kubernetes集群。它是工作的发现,我开始面临以下问题:
kubectl get pods
The connection to the server localhost:8080 was refused - did you specify the right host or port?我该如何解决这个问题?kubernetes-apiserver看起来没有运行,我如何让它工作?
kubectl run nginx --image=nginx:1.10.0
error: failed to discover supported resources: Get http://localhost:8080/apis/apps/v1beta1?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused请给出建议
发布于 2018-07-19 02:55:04
Kubernetes使用$KUBECONFIG文件连接到集群。可能是在配置kops集群时,它没有正确写入文件。我不能确定,因为你没有提供足够的信息。
假设这就是问题所在,并且您只有一个集群,它可以这样解决:
# Find your cluster name
kops get clusters
# set the clustername as a var
clustername=<clustername>
# export the KUBECONFIG variable, which kubectl uses to find the kubeconfig file
export KUBECONFIG=~/.kube/${clustername}
# download the kubeconfig file locally using kops
kops export kubecfg --name ${clustername} --config=~$KUBECONFIG您可以找到有关KUBECONFIG文件here的更多信息
发布于 2020-01-15 23:35:56
在使用kubectl之前必须启动minikube我也遇到过同样的问题,但我的问题是因为minikube没有运行
https://stackoverflow.com/questions/51408636
复制相似问题