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”.
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: