Ich kann auf das Kubernetes-Dashboard zugreifen, indem ich dessen URL über abrufe minikube dashboard --url
. Bei diesem Ansatz wird jedoch bei jedem Neustart des Minikube-Clusters ein anderer Portname verwendet. Daher versuche ich, ingress-nginx
den Dienst Kubernetes-Dashboard hinzuzufügen und verfügbar zu machen:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: k8s-dashboard-ingress
namespace: kubernetes-dashboard
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: kube-dashboard.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kubernetes-dashboard
port:
number: 80
kube-dashboard.local
wird der IP-Adresse der Cluster-IP-Adresse mit zugeordnet /etc/hosts
. Dies scheint zu funktionieren und der Browser erhält einige anfängliche Inhalte, aber das Browserfenster bleibt leer. Es scheint, dass nur die anfängliche Anfrage an das Dashboard weitergeleitet wird, aber die anderen Anfragen für die JS-Ressourcen schlagen irgendwie fehl. Was ist falsch an der Ingress-Regel?
minikube kubectl -- describe service kubernetes-dashboard -n kubernetes-dashboard
Name: kubernetes-dashboard
Namespace: kubernetes-dashboard
Labels: addonmanager.kubernetes.io/mode=Reconcile
k8s-app=kubernetes-dashboard
kubernetes.io/minikube-addons=dashboard
Annotations: <none>
Selector: k8s-app=kubernetes-dashboard
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.105.10.141
IPs: 10.105.10.141
Port: <unset> 80/TCP
TargetPort: 9090/TCP
Endpoints: 10.244.1.186:9090
Session Affinity: None
Events: <none>
minikube kubectl -- get ingress -n kubernetes-dashboard
NAME CLASS HOSTS ADDRESS PORTS AGE
k8s-dashboard-ingress nginx kube-dashboard.local 192.168.58.2 80 11h
minikube kubectl -- describe ingress k8s-dashboard-ingress -n kubernetes-dashboard
Name: k8s-dashboard-ingress
Labels: <none>
Namespace: kubernetes-dashboard
Address: 192.168.58.2
Ingress Class: nginx
Default backend: <default>
Rules:
Host Path Backends
---- ---- --------
kube-dashboard.local
/ kubernetes-dashboard:80 (10.244.1.186:9090)
Annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1
Events: <none>
Protokolle des Ingress-Pods:
192.168.58.1 - - [12/Sep/2023:17:28:57 +0000] "GET / HTTP/1.1" 200 821 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" 364 0.002 [kubernetes-dashboard-kubernetes-dashboard-80] [] 10.244.1.186:9090 821 0.002 200 e71b7c14812998f8561b5175cc0f0b3a
192.168.58.1 - - [12/Sep/2023:17:28:57 +0000] "GET /runtime.134ad7745384bed8.js HTTP/1.1" 200 821 "http://kube-dashboard.local/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" 318 0.002 [kubernetes-dashboard-kubernetes-dashboard-80] [] 10.244.1.186:9090 821 0.002 200 c55b47568d3dafe06b1a9ccaf18442d7
192.168.58.1 - - [12/Sep/2023:17:28:57 +0000] "GET /scripts.2c4f58d7c579cacb.js HTTP/1.1" 200 821 "http://kube-dashboard.local/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" 318 0.003 [kubernetes-dashboard-kubernetes-dashboard-80] [] 10.244.1.186:9090 821 0.003 200 20d5cd52673bc584ff05f54feb76fa99
192.168.58.1 - - [12/Sep/2023:17:28:57 +0000] "GET /en.main.3550e3edca7d0ed8.js HTTP/1.1" 200 821 "http://kube-dashboard.local/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" 318 0.004 [kubernetes-dashboard-kubernetes-dashboard-80] [] 10.244.1.186:9090 821 0.004 200 69b2b69e0fc4a406982c449cc661dd01
192.168.58.1 - - [12/Sep/2023:17:28:57 +0000] "GET /polyfills.5c84b93f78682d4f.js HTTP/1.1" 200 821 "http://kube-dashboard.local/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" 320 0.005 [kubernetes-dashboard-kubernetes-dashboard-80] [] 10.244.1.186:9090 821 0.005 200 1614d55b9416bab79683a87254d8992d
192.168.58.1 - - [12/Sep/2023:17:28:57 +0000] "GET /assets/images/kubernetes-logo.png HTTP/1.1" 200 821 "http://kube-dashboard.local/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" 346 0.002 [kubernetes-dashboard-kubernetes-dashboard-80] [] 10.244.1.186:9090 821 0.002 200 4414ae9d92778f8a2440829124251adc
Es gibt keine Log-Meldung, die anzeigt, dass etwas bei pod angekommen ist kubernetes-dashboard
. Wenn ich die URL von verwende minikube dashboard --url
, kann ich die folgenden Logs sehen:
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Incoming HTTP/1.1 GET /api/v1/service/kubernetes-dashboard/kubernetes-dashboard/ingress?itemsPerPage=10&page=1&sortBy=d,creationTimestamp request from 127.0.0.1:
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Incoming HTTP/1.1 GET /api/v1/service/kubernetes-dashboard/kubernetes-dashboard/event?itemsPerPage=10&page=1&sortBy=d,lastSeen request from 127.0.0.1:
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Incoming HTTP/1.1 GET /api/v1/service/kubernetes-dashboard/kubernetes-dashboard request from 127.0.0.1:
2023/09/12 17:34:08 Getting details of kubernetes-dashboard service in kubernetes-dashboard namespace
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Incoming HTTP/1.1 GET /api/v1/namespace request from 127.0.0.1:
2023/09/12 17:34:08 Getting list of namespaces
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Incoming HTTP/1.1 GET /api/v1/service/kubernetes-dashboard/kubernetes-dashboard/pod?itemsPerPage=10&page=1&sortBy=d,creationTimestamp request from 127.0.0.1:
2023/09/12 17:34:08 Found 0 events related to kubernetes-dashboard service in kubernetes-dashboard namespace
2023/09/12 17:34:08 Found 1 endpoints related to kubernetes-dashboard service in kubernetes-dashboard namespace
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Outcoming response to 127.0.0.1 with 200 status code
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Outcoming response to 127.0.0.1 with 200 status code
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Outcoming response to 127.0.0.1 with 200 status code
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Outcoming response to 127.0.0.1 with 200 status code
2023/09/12 17:34:08 Getting pod metrics
2023/09/12 17:34:08 [2023-09-12T17:34:08Z] Outcoming response to 127.0.0.1 with 200 status code
2023/09/12 17:34:11 Getting application global configuration
2023/09/12 17:34:11 Application configuration {"serverTime":1694540051060}
...