kubernetes / dashboard

General-purpose web UI for Kubernetes clusters
Apache License 2.0
14.47k stars 4.17k forks source link

Getting "400 Bad Request The plain HTTP request was sent to HTTPS port" when trying to access dashboard UI in browser #9237

Closed maisam94 closed 4 months ago

maisam94 commented 4 months ago

What happened?

I upgraded to the 7.5.0 release of the helm chart for the k8s-dashboard. I am getting "400 Bad Request The plain HTTP request was sent to HTTPS port" when loading the webpage for the UI in my browser. I expected to see a login page where I can supply a token.

I did clean installation for the new helm chart with ingress enabled and a couple parameters defined such as annotations, ingress class name, host and lets-encrypt for ssl connection, but when trying to access the dashboard UI in my browser, I got "400 Bad Request ..."

These are the values that I am supplying to the helm chart:

app: ingress: useDefaultAnnotations: false enabled: true annotations: ingress.kubernetes.io/force-ssl-redirect: 'true' konghq.com/strip-path: 'true' ingressClassName: kong hosts:

kong: enabled: true ingressController: enabled: true proxy: type: LoadBalancer annotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true" I would like to be able to reach the dashboard UI from outside the cluster via Https protocol with custom host. so what should be configured or how would I point to kong proxy when using the ingress provided in the helm chart?

If there is any other information I can provide, please let me know. Thank you for your help!

What did you expect to happen?

Access dashboard by HTTPS connection on web browser

How can we reproduce it (as minimally and precisely as possible)?

Enabling ingress with https connection and try to access the dashboard by web browser

Anything else we need to know?

Connecting the dashboard by HTTP has success but when adding ingress and HTTPS Getting "400 Bad Request The plain HTTP request was sent to HTTPS port"

What browsers are you seeing the problem on?

No response

Kubernetes Dashboard version

7.5.0

Kubernetes version

1.28

Dev environment

No response

tbernacchi commented 4 months ago

You have to set --insecure-port on your deployment k edit deploy/kubernetes-dashboard-web -n kubernetes-dashboard and then you have to deploy a certificate on your ingress. In this way as the error says "HTTP request was sent to HTTPS port" it's correct because the final destination it's 443. In this way I've suggested the certificate (https) will be in the first layer of your request. Ingress (https) -> svc -> pod (--insecure-port). Hope that helps you

alessandroperetti commented 4 months ago

Try to enable kong.proxy.http.enabled from helm:

helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard --set kong.proxy.http.enabled=true

floreks commented 4 months ago

This is a configuration issue, not a bug. If you need support, you can open i.e. a discussion. We do not provide support via issues.

/close

k8s-ci-robot commented 4 months ago

@floreks: Closing this issue.

In response to [this](https://github.com/kubernetes/dashboard/issues/9237#issuecomment-2235858666): >This is a configuration issue, not a bug. If you need support, you can open i.e. a [discussion](https://github.com/kubernetes/dashboard/discussions). We do not provide support via issues. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.