Access Kubernetes Dashboard Via HTTP Instead of HTTPS

kubernetesmicrok8s

Question

How can I enable HTTP requests? I have a primary web server that is a proxy and sends HTTP requests to the MicroK8S server but cannot due to the HTTP error.

Install command used:

sudo snap install microk8s --classic --channel=1.23/stable

Infrastructure

Self-Hosted on a virtual machine locally

Problem

I have a MicroK8S server setup using this command: microk8s enable dashboard dns registry istio

I have also edited the dashboard service as such (replaced clusterip with nodeport)

kubernetes-dashboard service

enter image description here

enter image description here

Result

I can navigate to the kubernetes-dashboard by going to https://IP:30051/ of the server (yes, requests using SSL work). However if I try to use HTTP instead of HTTPS I get the following error message.

Client sent an HTTP request to an HTTPS server.

Best Answer

Answered in Slack, the default addon doesn't pass --insecure-bind-address so the insecure port is accessible only on localhost: https://github.com/kubernetes/kubernetes/blob/b5103f61175a10d6b066eeb3ef603263f9b61bd4/cluster/addons/dashboard/dashboard.yaml#L195-L196

You can find all options documented here: https://github.com/kubernetes/dashboard/blob/1148f7ba9f9eadd719e53fa3bc8bde5b7cfdb395/docs/common/dashboard-arguments.md#arguments

If you add --insecure-bind-address=0.0.0.0 to the CLI options and switch your service to port 9090 then you can use HTTP instead.

But also just don't do this, it's a bad and unsafe idea.

Related Topic