Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboard login page responds with Unknown error (200): Http failure during parsing for http://10.255.15.136:32260/api/v1/csrftoken/login #9066

Closed
giorgiberia opened this issue May 21, 2024 · 9 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@giorgiberia
Copy link

What happened?

https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
fallowed this guide
created
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:

  • kind: ServiceAccount
    name: admin-user
    namespace: kubernetes-dashboard

apiVersion: v1
kind: Secret
metadata:
name: admin-user
namespace: kubernetes-dashboard
annotations:
kubernetes.io/service-account.name: "admin-user"
type: kubernetes.io/service-account-token

image
and created long lived token successfully

What did you expect to happen?

after inserting token and clicking on sign in i expect to login and access dashboard

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

i had earlier dashboard version even before helm got default.
deleted everything that was associated with that.

kubectl delete deployment kubernetes-dashboard -n kubernetes-dashboard
kubectl delete service kubernetes-dashboard -n kubernetes-dashboard
kubectl delete deployment dashboard-metrics-scraper -n kubernetes-dashboard
kubectl delete service dashboard-metrics-scraper -n kubernetes-dashboard
kubectl delete replicaset -l k8s-app=kubernetes-dashboard -n kubernetes-dashboard
kubectl delete secret kubernetes-dashboard-certs -n kubernetes-dashboard
kubectl delete serviceaccount kubernetes-dashboard -n kubernetes-dashboard
kubectl delete secret kubernetes-dashboard-csrf kubernetes-dashboard-key-holder -n kubernetes-dashboard

and installed using helm

helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard
Release "kubernetes-dashboard" does not exist. Installing it now.
NAME: kubernetes-dashboard
LAST DEPLOYED: Tue May 21 12:20:57 2024
NAMESPACE: kubernetes-dashboard
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:


*** PLEASE BE PATIENT: Kubernetes Dashboard may need a few minutes to get up and become ready ***


when everything was ready
i did what i described in "What happened?" section

Anything else we need to know?

No response

What browsers are you seeing the problem on?

Chrome, Firefox

Kubernetes Dashboard version

kubernetes-dashboard-7.4.0

Kubernetes version

v1.30.1

Dev environment

i am not running dashboard locally

@giorgiberia giorgiberia added the kind/bug Categorizes issue or PR as related to a bug. label May 21, 2024
@floreks
Copy link
Member

floreks commented May 21, 2024

I don't see any description of what actually happened and how did you access dashboard? Can you provide more details?

@m839336369
Copy link

m839336369 commented May 22, 2024

I closed Kong and used Istio to create it. The routing rules exposed the web and prompted
Unknown error (200): Http failure during parsing for http://10.255.15.136:32260/api/v1/csrftoken/login

Then I exposed the authorization in the routing rule, prompting Unauthorized (401): Invalid credentials provided

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: kubernetes-dashboard-http-route
namespace: kubernetes-dashboard
spec:
parentRefs:

  • name: gateway
    namespace: istio-system
    rules:
  • matches:
    • path:
      type: PathPrefix
      value: /api/v1/login
    • path:
      type: PathPrefix
      value: /api/v1/csrftoken/login
    • path:
      type: PathPrefix
      value: /api/v1/me
      backendRefs:
    • kind: Service
      name: kubernetes-dashboard-auth
      port: 8000
  • matches:
    • path:
      type: PathPrefix
      value: /api
      type: PathPrefix
      value: /metrics
      backendRefs:
    • kind: Service
      name: kubernetes-dashboard-api
      port: 8000
  • matches:
    • path:
      type: PathPrefix
      value: /
      backendRefs:
    • kind: Service
      name: kubernetes-dashboard-web
      port: 8000

@giorgiberia
Copy link
Author

did you expose dashboard by changing web's service from clusterip to nodeport?

@giorgiberia
Copy link
Author

helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard
after i ran this command i was shown this.

kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443
and ran this.
tried access with http://10.255.15.136:8443
was not accessible

then i changed kubernetes-dashboard-web service from clusterip to nodeport giving 32260 but

getting Unknown error (200): Http failure during parsing for http://10.255.15.136:32260/api/v1/csrftoken/login

@m839336369
Copy link

helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard after i ran this command i was shown this.

kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 and ran this. tried access with http://10.255.15.136:8443 was not accessible

then i changed kubernetes-dashboard-web service from clusterip to nodeport giving 32260 but

getting Unknown error (200): Http failure during parsing for http://10.255.15.136:32260/api/v1/csrftoken/login

you shuold expose NodePort for kong-proxy rather than board-web.

@m839336369
Copy link

I closed Kong and used Istio to create it. The routing rules exposed the web and prompted Unknown error (200): Http failure during parsing for http://10.255.15.136:32260/api/v1/csrftoken/login

Then I exposed the authorization in the routing rule, prompting Unauthorized (401): Invalid credentials provided

apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: kubernetes-dashboard-http-route namespace: kubernetes-dashboard spec: parentRefs:

  • name: gateway
    namespace: istio-system
    rules:

  • matches:

    • path:
      type: PathPrefix
      value: /api/v1/login
    • path:
      type: PathPrefix
      value: /api/v1/csrftoken/login
    • path:
      type: PathPrefix
      value: /api/v1/me
      backendRefs:
    • kind: Service
      name: kubernetes-dashboard-auth
      port: 8000
  • matches:

    • path:
      type: PathPrefix
      value: /api
      type: PathPrefix
      value: /metrics
      backendRefs:
    • kind: Service
      name: kubernetes-dashboard-api
      port: 8000
  • matches:

    • path:
      type: PathPrefix
      value: /
      backendRefs:
    • kind: Service
      name: kubernetes-dashboard-web
      port: 8000

I have resolved this issue, as the access is IP access and cannot carry cookies, which contain token verification information, resulting in 401
Using domain name access can solve the problem

@giorgiberia
Copy link
Author

helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard after i ran this command i was shown this.
kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 and ran this. tried access with http://10.255.15.136:8443 was not accessible
then i changed kubernetes-dashboard-web service from clusterip to nodeport giving 32260 but
getting Unknown error (200): Http failure during parsing for http://10.255.15.136:32260/api/v1/csrftoken/login

you shuold expose NodePort for kong-proxy rather than board-web.

i reinstalled it and exposed kong proxy instead of board-web and got 401
created token and accessed dashboard
thank you

@floreks
Copy link
Member

floreks commented May 27, 2024

/close

@k8s-ci-robot
Copy link
Contributor

@floreks: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants