Kubernetes错误。无法连接到服务器: dial tcp 127.0.0.1:8080 | 您所在的位置:网站首页 › ps4哪一年停产的 › Kubernetes错误。无法连接到服务器: dial tcp 127.0.0.1:8080 |
百度翻译此文
有道翻译此文
问题描述
I'm seeing the following error when running kubectl get pods: Unable to connect to the server: dial tcp 127.0.0.1:8080: connectex: No connection could be made because the target machine actively refused it.This was working when I ran it two weeks ago. My config file in the ~/.kube/config directory looks as follows: apiVersion: v1 clusters: - cluster: insecure-skip-tls-verify: true server: https://zld05687.vci.co.com name: dev-cluster - cluster: insecure-skip-tls-verify: true server: https://zlt20087.vci.co.com name: perf-cluster - cluster: insecure-skip-tls-verify: true server: https://zlt17291.vci.co.com name: test-cluster contexts: - context: cluster: dev-cluster namespace: com-co-acp-dev user: default-user name: default-context - context: cluster: perf-cluster namespace: com-co-acp-perf user: default-user name: perf-context - context: cluster: test-cluster namespace: com-co-acp-test user: default-user name: test-context current-context: perf-context kind: Config preferences: {} users: - name: default-user user: token: myusername:enc:23hfeu39393yd223944uekdWhat caused this error, and how can I fix it? 推荐答案If you have kubectl already installed and pointing to some other environment, such as minikube or a GKE cluster, be sure to change context so that kubectl is pointing to docker-desktop: kubectl config get-contexts kubectl config use-context docker-desktop 其他推荐答案It looks like the Kubernetes is not running on your machine. As your question doesn't mention the environment. I had similar issues with the following setup. Windows 7 with Docker Toolbox 18.09.6 Kubernetes v1.14.3 minikube v1.1.1. You would need to start Kubernetes and check if it displays the cluster information correctly before getting the pods. Run the following commands to setup & display cluster info. minikube start kubectl cluster-info kubectl get podsNot sure if it applies to your environment, but I was having similar issue - any kubectl commands were returning: Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it. 127.0.0.1 is local host (IPV4), [::1] is the IPV6 equivalent. kubectl appears to set up a local connection proxy on localhost to the cluster controller. In my case on a Windows10 pc, running the session ( in my case it was a powershell window) as administrator resolved the issue. Anyway, that was the fix for my environment. |
CopyRight 2018-2019 实验室设备网 版权所有 |