2

I am trying to embed Kubernetes Dashboard UI in an iFrame. I am able to see the login page, but when I try to login by providing the token, it does not load the dashboard and I stay on the Login Page itself. I suspect it has to do something with CORS and Access-Control-Allow-Origin setting.

Can someone tell how to make the right configuration so that I can access the Kubernetes Dashboard UI in an iFrame. I am able to access the UI without iFrame perfectly

In the iFrame, I get the following error in Javascript Console when I login via iFrame

“jweToken” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”.
Kinshuk
  • 21
  • 2
  • Have you tried to enable the browser's dev mode ? Do you have any errors ? – Alexandre Cartapanis Sep 21 '20 at 22:00
  • I am gettingthis error when I login in iFrame Cookie “jweToken” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”. – Kinshuk Sep 22 '20 at 04:57

1 Answers1

0

You can add an ingress to expose the dashboard service and add CORS annotations to allow more origins (https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#enable-cors). Note that if you are using the dashboard's helm chart, it already contains an ingress, so you can directly add annotations using the ingress.annotations value.

There is some other solutions:

Alexandre Cartapanis
  • 1,513
  • 3
  • 15
  • 19