tidb-operator icon indicating copy to clipboard operation
tidb-operator copied to clipboard

tidb dashboard can not access from nodeports

Open weironz opened this issue 3 years ago • 1 comments

Bug Report

What version of Kubernetes are you using? v1.24.3

What version of TiDB Operator are you using? 1.3.7

What storage classes exist in the Kubernetes cluster and what are used for PD/TiKV pods? longhorn

What's the status of the TiDB cluster pods?

root@node01:~# kubectl get pods -A |grep tidb
tidb-admin        tidb-controller-manager-87dd86978-g65rl        1/1     Running   3 (29m ago)     96m
tidb-admin        tidb-scheduler-6575447f4d-5dbjv                2/2     Running   2 (30m ago)     96m
tidb-cluster      tidb-cluster-discovery-b54bdfd8b-vcl7r         1/1     Running   0               83m
tidb-cluster      tidb-cluster-monitor-8685b5bb75-k4mpn          3/3     Running   0               84m
tidb-cluster      tidb-cluster-pd-0                              1/1     Running   0               84m
tidb-cluster      tidb-cluster-pd-1                              1/1     Running   1 (75m ago)     84m
tidb-cluster      tidb-cluster-pd-2                              1/1     Running   0               84m
tidb-cluster      tidb-cluster-tidb-0                            2/2     Running   0               73m
tidb-cluster      tidb-cluster-tidb-1                            2/2     Running   0               73m
tidb-cluster      tidb-cluster-tikv-0                            1/1     Running   0               75m
tidb-cluster      tidb-cluster-tikv-1                            1/1     Running   0               75m
tidb-cluster      tidb-cluster-tikv-2                            1/1     Running   0               75m

What did you do? enable dashboard

root@node01:~# kubectl -n tidb-cluster get TidbCluster -o yaml |grep enableDashboardInternalProxy
      enableDashboardInternalProxy: true

create service

root@node01:~# kubectl -n tidb-cluster get svc access-dashboard -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"access-dashboard","namespace":"tidb-cluster"},"spec":{"ports":[{"name":"dashboard","port":10262,"protocol":"TCP","targetPort":10262}],"selector":{"app.kubernetes.io/component":"discovery","app.kubernetes.io/instance":"tidb-cluster","app.kubernetes.io/name":"tidb-cluster"},"type":"NodePort"}}
  creationTimestamp: "2022-08-05T06:06:27Z"
  name: access-dashboard
  namespace: tidb-cluster
  resourceVersion: "189901"
  uid: 5d04a87e-18dd-4443-a411-4ce8b6635f97
spec:
  clusterIP: 10.96.3.232
  clusterIPs:
  - 10.96.3.232
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: dashboard
    nodePort: 32480
    port: 10262
    protocol: TCP
    targetPort: 10262
  selector:
    app.kubernetes.io/component: discovery
    app.kubernetes.io/instance: tidb-cluster
    app.kubernetes.io/name: tidb-cluster
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer: {}

access dashborad from browser with the follow url

http://192.168.72.50:32480/dashboard

it will Automatically jump to the following link , and access failed

http://tidb-cluster-pd-2.tidb-cluster-pd-peer.tidb-cluster.svc:2379/dashboard/

error log

DevTools failed to load source map: Could not load content for http://192.168.72.50:32480/dashboard/static/css/main.53e4d5a1.chunk.css.map: HTTP error: status code 502, net::ERR_HTTP_RESPONSE_CODE_FAILURE
192.168.72.50/:1          GET http://tidb-cluster-pd-2.tidb-cluster-pd-peer.tidb-cluster.svc:2379/dashboard/static/js/main.ec46ea1d.chunk.js net::ERR_ABORTED 502 (Bad Gateway)
192.168.72.50/:1          GET http://tidb-cluster-pd-2.tidb-cluster-pd-peer.tidb-cluster.svc:2379/dashboard/static/js/4.0d5d2c6c.chunk.js net::ERR_ABORTED 502 (Bad Gateway)

if use https will 404

https://192.168.72.50:32480/dashboard

What did you expect to see? access and login dashboard success.

What did you see instead? access and login dashboard failed.

weironz avatar Aug 05 '22 06:08 weironz

Which tidb cluster version was used?

KanShiori avatar Aug 08 '22 10:08 KanShiori

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Nov 09 '22 00:11 github-actions[bot]