Score:2

Access Kubernetes Dashboard Via HTTP Instead of HTTPS

es flag
Pie

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.

Bazhikov avatar
in flag
Please provide more information about your current setup - which Kubernetes version are you using, which solution did you use to setup a cluster (kubeadm or some cloud provider solution etc.).
Pie avatar
es flag
Pie
@Bazhikov provided the requested updates. However, the process for allowing HTTP for the dashboard I imagine would be the same regardless of version.
Score:0
jp flag

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.

Pie avatar
es flag
Pie
There is a login-not-available error when using HTTP. How do I get around this? https://github.com/kubernetes/dashboard/blob/master/docs/user/accessing-dashboard/README.md#login-not-available
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.