1

We've setup a kubernetes cluster with 3 masters and 3 workernodes. Then we've installed the kubernetes-dashboard which failes because it can't connect to kubernetes (api-server). It's looking for localhost:8080 but it's not reachable. When executing env in a busybox I receive:

KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT=tcp://10.2.0.1:443
KUBERNETES_PORT_443_TCP=tcp://10.2.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_ADDR=10.2.0.1
KUBERNETES_SERVICE_HOST=10.2.0.1
KUBERNETES_SERVICE_PORT=443

So I would expect that kubernetes should be available on 10.2.0.1:443 but it doesn't answer. (Connection refused)

The bind-address is 0.0.0.0 (which is secured by ssl auth) the insecure-bind-address is unset (which means it's bound to 127.0.0.1). Within the documentations I can see that the unsecured port (8080) is exposed to the cluster-network. But I can't see it. If I execute kubectl get services I see:

NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   10.2.0.1     <none>        443/TCP   1d

Do I have to take some more actions to expose 8080 there and/or make kubernetes available on these ports?

1
  • As far it relates to the availability of the 443 port it's solved. The setup runs in a vm and has a little different ip configuration (public ip a which is mapped to ip b on the interface). After setting the --advertise-address to the public ip a I can connect to 443 and it answers as expected. But I need the port 8080 to be available in the cluster.
    – meme
    Jun 14, 2016 at 13:41

2 Answers 2

0

Connecting to localhost:8080 is the default behavior when a Kubernetes client isn't configured with a specific location of an apiserver. Typically, the dashboard connects to the apiserver using the "In cluster credentials" that are added to the pod via a service account.

0

This is the typical behaviour when root is used for kubectl and /etc/kubernetes/admin.conf is not in /root/.kube/config (you need to rename it).

The recommended procedure is to create a non-root user e.x(kubeadmin) and place /etc/kubernetes/admin.conf in /home/of/kubeadmin/.kube/config

[root@k8s-1 ~]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[root@k8s-1 ~]# mkdir /root/.kube
[root@k8s-1 ~]# cp /etc/kubernetes/admin.conf /root/.kube/config
[root@k8s-1 ~]# kubectl get nodes
NAME        STATUS   ROLES    AGE    VERSION
k8s-node1   Ready    master   90d    v1.12.3
k8s-node2   Ready    <none>   90d    v1.12.3
k8s-node3   Ready    <none>   90d    v1.12.3
k8s-node4   Ready    <none>   6d1h   v1.12.3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .