0

I am new at kubernetes and I am trying to setup a clsuter on a remote server. For this I use microk8s and a server from hetzner-cloud (https://www.hetzner.com/de/cloud).

I entered the server with ssh and followd the microk8s installation instructions for linux(https://microk8s.io/). That all seemed to work fine. My problem is now that I have not found a way to access the kubernetes-dashboard.

I've tryed the workaround with NodePort and microk8s kubectl proxy --disable-filter = true but it does not work and is not recommended for security reasons. With the disable Filter Method it is possible to access the login page but it does not respond.

I've also tryed to access the dashbourd from outside using a ssh tunnel and this tutorial: How can I remotely access kubernetes dashboard with token

The tunnel seems to works fine, but I still cannot access the port.

Now I have two main questions:

1: How do you usualy use kubernetes, if kubernetes does not wan you to access the dashboard from outside. Because don't you run your services usualy on a rented server that is not in you living room? What's the point I simply do not get?

2: How can I access the Dashborad?

I would be really happy, if anybody could help me. I am already struggling with this problem since a month now. :)

best greetings, mamo

mamo
  • 3
  • 3
  • Hello, @mamo, welcome to Stack Overflow. Are you sure your cloud provider allows traffic on port required by dashboard? I had no problems accessing Dasboard on GCP after default install, and allowing traffic on 10443 port –  May 28 '21 at 09:31
  • @PawełGrondal thank you very much for your answer. I will ask my provider immediately, is it possible you change the port. because I've already tried 'kubectl proxy --port="8080' and other ports. – mamo May 31 '21 at 14:17
  • @PawełGrondal google has a built in kubernetes. Do you use that or did you set it up yourself? – mamo May 31 '21 at 14:18
  • No, I built it from ground up using `kubeadm`. I also had to create firewall rule allowing traffic on port 10443. –  Jun 01 '21 at 06:58

1 Answers1

0

In order to access the K8s services from outside using HTTP, you should configure and use ingress controller.

after ingress is running, you will be able to specify a "path" or route and a port and name that points to your service.

Once this is done, you should be able to access the dashboard

Sample configuration (reference)

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dashboard-google
  namespace: kube-system
  annotations:
    nginx.ingress.kubernetes.io/secure-backends: "true"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
  tls:
    - hosts:
      - kube.mydomain.com
      secretName: tls-secret
  rules:
    - host: kube.mydomain.com
      http:
        paths:
        - path: /
          backend:
            serviceName: kubernetes-dashboard
            servicePort: 443
Rakesh Gupta
  • 3,507
  • 3
  • 18
  • 24