kubernetes dashoboard 「Error trying to reach service: 'proxyconnect tcp: dial tcp: lookup $http_proxy: no such host」

1/25/2020

I installed k8s dashboard as written in "https://github.com/kubernetes/dashboard".

However, I cannot access this URL. http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

I receive

Error trying to reach service: 'proxyconnect tcp: dial tcp: lookup $http_proxy: no such host」.

(I can access this URL. http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/)

Here is my status. My cluster seem to be no problem. (And I'm under proxy circumstances, but there is no problem docker pull.)

# kubectl get nodes
NAME         STATUS   ROLES    AGE   VERSION
k8s-master   Ready    master   43h   v1.17.1
k8s-worker   Ready    <none>   39h   v1.17.2

# kubectl get pods --all-namespaces
NAMESPACE              NAME                                         READY   STATUS    RESTARTS   AGE
kube-system            coredns-6955765f44-g9nzl                     1/1     Running   1          44h
kube-system            coredns-6955765f44-vxldl                     1/1     Running   1          44h
kube-system            etcd-k8s-master                              1/1     Running   4          44h
kube-system            kube-apiserver-k8s-master                    1/1     Running   3          44h
kube-system            kube-controller-manager-k8s-master           1/1     Running   3          44h
kube-system            kube-proxy-5bzwf                             1/1     Running   3          44h
kube-system            kube-proxy-5z84p                             1/1     Running   0          40h
kube-system            kube-scheduler-k8s-master                    1/1     Running   4          44h
kube-system            weave-net-l5ptw                              2/2     Running   3          40h
kube-system            weave-net-qcwk2                              2/2     Running   0          40h
kubernetes-dashboard   dashboard-metrics-scraper-7b64584c5c-wxsd2   1/1     Running   0          57m
kubernetes-dashboard   kubernetes-dashboard-566f567dc7-b88n2        1/1     Running   0          57m


# docker info | grep Proxy
HTTP Proxy: http://10.227.74.6:3128
HTTPS Proxy: http://10.227.74.6:3128
No Proxy: localhost,127.0.0.1,10.227.74.4,10.227.74.37,10.96.0.0/12,10.244.0.0/16

# cat /etc/bashrc
export http_proxy=http://10.227.74.6:3128
export https_proxy=http://10.227.74.6:3128
export no_proxy="localhost,127.0.0.1,10.227.74.4,10.227.74.37,10.96.0.0/12,10.244.0.0/16"

I imagine my proxy setting is not good, but I'm not sure how I should fix it.

I'm sorry I'm not good at English. Please answer this question.

# curl http://localhost:8001/api/v1/namespaces/kubernetes- 
dashboard/services/

{
"kind": "ServiceList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/kubernetes-dashboard/services/",
"resourceVersion": "448220"
},
"items": [
{
"metadata": {
"name": "dashboard-metrics-scraper",
...........

# curl http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
Error trying to reach service: 'proxyconnect tcp: dial tcp: lookup $http_proxy: no such host'

# curl http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
Error trying to reach service: 'proxyconnect tcp: dial tcp: lookup $http_proxy: no such host'
-- wabisuke66
kubernetes
kubernetes-dashboard
proxy
reverse-proxy

2 Answers

1/29/2020

First thing which I noticed is that you use the same url for http and https:

# docker info | grep Proxy
HTTP Proxy: http://10.227.74.6:3128
HTTPS Proxy: http://10.227.74.6:3128

For HTTPS Proxy url should start with https.

Modify /etc/sysconfig/docker file, example:

# cat /etc/sysconfig/docker
HTTP_PROXY="http://10.227.74.6:3128"
HTTPS_PROXY="http://10.227.74.6:3128"
NO_PROXY="localhost,127.0.0.1,10.227.74.4,10.227.74.37,10.96.0.0/12,10.244.0.0/16"

Then configure /etc/bashrc file:

# cat /etc/bashrc
export http_proxy="http://10.227.74.6:3128"
export https_proxy="https://10.227.74.6:3128"
export no_proxy="localhost,127.0.0.1,10.227.74.4,10.227.74.37,10.96.0.0/12,10.244.0.0/16"

After applying changes restart the Docker daemon.

Please follow those steps during proxy setup: proxy-configuration.

More information about setting proxy you can find here: proxy-server.

-- MaggieO
Source: StackOverflow

1/25/2020

It might be an intermittent issues due to your corporate proxy settings. The URL is working for me.

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login

-- Subramanian Manickam
Source: StackOverflow