Kubernetes Dashboard尝试访问服务时出错:“代理错误(连接被拒绝)”

时间:2020-03-17 08:46:24

标签: kubernetes proxy timeout kubectl kubernetes-dashboard

我对此说:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

然后运行:

nohup kubectl代理&

然后这样:

卷曲http://127.0.0.1:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

出现此错误:

尝试访问服务时出错:“代理错误(连接被拒绝)”

即使我运行此命令:

卷曲http://127.0.0.1:8001/api/v1/namespaces/kubernetes-dashboard/services/

我得到此输出,这意味着我可以很好地到达端口8001:

{
  "kind": "ServiceList",
  "apiVersion": "v1",
  "metadata": {
    "selfLink": "/api/v1/namespaces/kubernetes-dashboard/services/",
    "resourceVersion": "2232832"
  },
  "items": [
    {
      "metadata": {
        "name": "dashboard-metrics-scraper",
        "namespace": "kubernetes-dashboard",
        "selfLink": "/api/v1/namespaces/kubernetes-dashboard/services/dashboard-metrics-scraper",
        "uid": "716c5d85-d3d5-4f49-bcae-b77b848fc129",
        "resourceVersion": "2216232",
        "creationTimestamp": "2020-03-17T06:49:58Z",
        "labels": {
          "k8s-app": "dashboard-metrics-scraper"
        }
      },
      "spec": {
        "ports": [
          {
            "protocol": "TCP",
            "port": 8000,
            "targetPort": 8000
          }
        ],
        "selector": {
          "k8s-app": "dashboard-metrics-scraper"
        },
        "clusterIP": "10.107.93.77",
        "type": "ClusterIP",
        "sessionAffinity": "None"
      },
      "status": {
        "loadBalancer": {

        }
      }
    },
    {
      "metadata": {
        "name": "kubernetes-dashboard",
        "namespace": "kubernetes-dashboard",
        "selfLink": "/api/v1/namespaces/kubernetes-dashboard/services/kubernetes-dashboard",
        "uid": "76832e87-fa3a-44de-9d19-06b15efc8073",
        "resourceVersion": "2216216",
        "creationTimestamp": "2020-03-17T06:49:58Z",
        "labels": {
          "k8s-app": "kubernetes-dashboard"
        }
      },
      "spec": {
        "ports": [
          {
            "protocol": "TCP",
            "port": 443,
            "targetPort": 8443
          }
        ],
        "selector": {
          "k8s-app": "kubernetes-dashboard"
        },
        "clusterIP": "10.111.110.202",
        "type": "ClusterIP",
        "sessionAffinity": "None"
      },
      "status": {
        "loadBalancer": {

        }
      }
    }
  ]
}

有人请告知我可能忽略了什么。

kubectl获取pod -o宽--all-namespaces

kube-system            coredns-6955765f44-22n9z                                 1/1     Running   4          11d     10.32.0.2      svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            coredns-6955765f44-n9z5x                                 1/1     Running   4          11d     10.32.0.3      svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            etcd-svomniadm01dev.co-opbank.co.ke                      1/1     Running   4          11d     172.16.20.46   svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            kube-apiserver-svomniadm01dev.co-opbank.co.ke            1/1     Running   4          11d     172.16.20.46   svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            kube-controller-manager-svomniadm01dev.co-opbank.co.ke   1/1     Running   4          11d     172.16.20.46   svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            kube-proxy-29czc                                         1/1     Running   0          8d      172.16.20.48   svomniadm03dev.co-opbank.co.ke   <none>           <none>
kube-system            kube-proxy-gfzm2                                         1/1     Running   4          11d     172.16.20.46   svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            kube-proxy-xj2nb                                         1/1     Running   0          9d      172.16.20.47   svomniadm02dev.co-opbank.co.ke   <none>           <none>
kube-system            kube-scheduler-svomniadm01dev.co-opbank.co.ke            1/1     Running   4          11d     172.16.20.46   svomniadm01dev.co-opbank.co.ke   <none>           <none>
kube-system            weave-net-4ltpp                                          2/2     Running   1          9d      172.16.20.47   svomniadm02dev.co-opbank.co.ke   <none>           <none>
kube-system            weave-net-589gn                                          2/2     Running   1          8d      172.16.20.48   svomniadm03dev.co-opbank.co.ke   <none>           <none>
kube-system            weave-net-pj7bn                                          2/2     Running   11         11d     172.16.20.46   svomniadm01dev.co-opbank.co.ke   <none>           <none>
kubernetes-dashboard   dashboard-metrics-scraper-566cddb686-fs77w               1/1     Running   0          3h22m   10.44.0.1      svomniadm03dev.co-opbank.co.ke   <none>           <none>
kubernetes-dashboard   kubernetes-dashboard-7b5bf5d559-w2bxf                    1/1     Running   0          3h22m   10.32.0.2      svomniadm02dev.co-opbank.co.ke   <none>           <none>

0 个答案:

没有答案