How to setup kubernetes dashboard with an ingess controller

3/21/2018

I am very new to the idea of kubernetes. I found some good tutorials online to get my kubernetes cluster up & running. Right Now I want to add a kubernetes dashboard to my cluster so that it would be easy and good to have a page where I can watch how my pods and node's react (even do I'm more of a CLI guy, some GUI is not bad). I've downloaded the dashboard pod and it's up and running. Because the kubernetes cluster is running on a Raspberry Pi cluster I've set up a NodePort to access it from outside my cluster. But I've come to some problems where I can't find any problems too online.

  1. In my Linux host machine I can access the kubernetes dashboard but somehow in my Linux machine, my browsers won't add the cert exception.
  2. Some people online are convinced that NodePort is not safe enough. So I've done some research on other possibilities. I am very interested in the ingress controller to connect my dashboard. But I didn't find any good and full documentation how to set up an ingress controller (and more importantly what is happening, cause there are a lot of yaml files online and they say just run this but i have no clue what he is doing).

Can someone direct me to the right documentation/tutorial / or give me any help for my Kube dashboard?

-- ThefrEnchman
dashboard
kubernetes
kubernetes-ingress

2 Answers

3/21/2018

The first thing you will need to use in the deployment is Ingress so lets start with it.

Firstly you should create an Ingress controller, you can find the Installation Guide here

The most relevant is the first part - Generic Deployment which includes following:

Namespace for the Ingress controller installation:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/namespace.yaml \ | kubectl apply -f -

Default backend for Ingress controller:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/default-backend.yaml \ | kubectl apply -f -

And config maps:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/configmap.yaml \ | kubectl apply -f - 
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/tcp-services-configmap.yaml \ | kubectl apply -f - 
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/udp-services-configmap.yaml \ | kubectl apply -f -

Because you deployed your cluster on Raspberry Pi, all of this needs to be created manually.

After the Ingress controller is installed you can deploy specific configuration for your Ingress with rules to route traffic to your service.

Here is an example of Ingress yaml file:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: endpoint-to-the-world
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: your-external-address-for-the-cluster
    http:
      paths:
      - path: /console
        backend:
          serviceName: kubernetes-dashboard
          servicePort: 443
      - path: /some-other-path
        backend:
          serviceName: different-service
          servicePort: 22

This will act like an external proxy for your cluster and you can route all traffic to any service. More details can be read here.

This should be enough to have Kubernetes Dashboard exposed.

-- Nick Rak
Source: StackOverflow

3/21/2018

Someone in an other forum send me this tutorial which was very helpfull. I'll share it here also for all the people who've came to this post with the same question.

https://akomljen.com/kubernetes-nginx-ingress-controller/

-- ThefrEnchman
Source: StackOverflow