Minikube 仪表板入口

Minikube dashboard ingress

我正在尝试使用嵌入式仪表板内部服务为 minikube 仪表板创建入口。

我同时启用了 ingressdashboard minikube 插件。

我也写了这个 ingress YAML 文件:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dashboard-ingress
  namespace: kubernetes-dashboard
spec:
  rules:
  - host: dashboard.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: kubernetes-dashboard
            port: 
              number: 80

正如您所见,我的 Ingress 正在创建中:

NAME                CLASS   HOSTS           ADDRESS     PORTS   AGE
dashboard-ingress   nginx   dashboard.com   localhost   80      15s

我编辑了我的 /etc/hosts 添加了这一行:127.0.0.1 dashboard.com.

现在我正在尝试通过 dashboard.com 访问仪表板。但它不起作用。

kubectl describe ingress dashboard-ingress -n kubernetes-dashboard 给我这个:

Name:             dashboard-ingress
Namespace:        kubernetes-dashboard
Address:          localhost
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host           Path  Backends
  ----           ----  --------
  dashboard.com  
                 /   kubernetes-dashboard:80 (172.17.0.4:9090)
Annotations:     <none>
Events:
  Type    Reason  Age                From                      Message
  ----    ------  ----               ----                      -------
  Normal  Sync    14m (x2 over 14m)  nginx-ingress-controller  Scheduled for sync

我不太明白<error: endpoints "default-http-backend" not found>是什么意思,但也许我的问题来自于此。

kubectl get pods -n ingress-nginx 结果:

NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create--1-8krc7     0/1     Completed   0          100m
ingress-nginx-admission-patch--1-qblch      0/1     Completed   1          100m
ingress-nginx-controller-5f66978484-hvk9j   1/1     Running     0          100m

nginx-controller pod 的日志:

-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v1.0.4
  Build:         9b78b6c197b48116243922170875af4aa752ee59
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.9

-------------------------------------------------------------------------------

W1205 19:33:42.303136       7 client_config.go:615] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I1205 19:33:42.303261       7 main.go:221] "Creating API client" host="https://10.96.0.1:443"
I1205 19:33:42.319750       7 main.go:265] "Running in Kubernetes cluster" major="1" minor="22" git="v1.22.3" state="clean" commit="c92036820499fedefec0f847e2054d824aea6cd1" platform="linux/amd64"
I1205 19:33:42.402223       7 main.go:104] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I1205 19:33:42.413477       7 ssl.go:531] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"
I1205 19:33:42.420838       7 nginx.go:253] "Starting NGINX Ingress controller"
I1205 19:33:42.424731       7 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"ingress-nginx-controller", UID:"f2d27cc7-b103-490f-807f-18ccaa614e6b", APIVersion:"v1", ResourceVersion:"664", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I1205 19:33:42.427171       7 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"tcp-services", UID:"e174971d-df1c-4826-85d4-194598ab1912", APIVersion:"v1", ResourceVersion:"665", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/tcp-services
I1205 19:33:42.427195       7 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"udp-services", UID:"0ffc7ee9-2435-4005-983d-ed41aac1c9aa", APIVersion:"v1", ResourceVersion:"666", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/udp-services
I1205 19:33:43.622661       7 nginx.go:295] "Starting NGINX process"
I1205 19:33:43.622746       7 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader...
I1205 19:33:43.623402       7 nginx.go:315] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"
I1205 19:33:43.623683       7 controller.go:152] "Configuration changes detected, backend reload required"
I1205 19:33:43.643547       7 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader
I1205 19:33:43.643635       7 status.go:84] "New leader elected" identity="ingress-nginx-controller-5f66978484-hvk9j"
I1205 19:33:43.691342       7 controller.go:169] "Backend successfully reloaded"
I1205 19:33:43.691395       7 controller.go:180] "Initial sync, sleeping for 1 second"
I1205 19:33:43.691435       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-5f66978484-hvk9j", UID:"55d45c26-eda7-4b37-9b04-5491cde39fd4", APIVersion:"v1", ResourceVersion:"697", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I1205 21:06:47.402756       7 main.go:101] "successfully validated configuration, accepting" ingress="dashboard-ingress/kubernetes-dashboard"
I1205 21:06:47.408929       7 store.go:371] "Found valid IngressClass" ingress="kubernetes-dashboard/dashboard-ingress" ingressclass="nginx"
I1205 21:06:47.409343       7 controller.go:152] "Configuration changes detected, backend reload required"
I1205 21:06:47.409352       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"kubernetes-dashboard", Name:"dashboard-ingress", UID:"be1ebfe9-fdb3-4d0c-925b-0c206cd0ece3", APIVersion:"networking.k8s.io/v1", ResourceVersion:"5529", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I1205 21:06:47.458273       7 controller.go:169] "Backend successfully reloaded"
I1205 21:06:47.458445       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-5f66978484-hvk9j", UID:"55d45c26-eda7-4b37-9b04-5491cde39fd4", APIVersion:"v1", ResourceVersion:"697", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I1205 21:07:43.654037       7 status.go:300] "updating Ingress status" namespace="kubernetes-dashboard" ingress="dashboard-ingress" currentValue=[] newValue=[{IP: Hostname:localhost Ports:[]}]
I1205 21:07:43.660598       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"kubernetes-dashboard", Name:"dashboard-ingress", UID:"be1ebfe9-fdb3-4d0c-925b-0c206cd0ece3", APIVersion:"networking.k8s.io/v1", ResourceVersion:"5576", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync

有人知道我该如何解决我的问题吗?

(我使用的是 minikube v1.24.0)

此致,

我在使用 Minikube 的 Ingress 时遇到了类似的问题,但我使用的是 Windows。

经过深入搜索,我发现问题出在Docker的驱动程序上。

我将驱动程序更改为 VirtualBox,Ingress 开始按预期运行。

提供了更多详细信息。

我在本地的 minikube(v1.25.1) 运行 也遇到了同样的问题。

kubectl get ingress -n kubernetes-dashboard

NAME                CLASS   HOSTS           ADDRESS     PORTS   AGE
dashboard-ingress   nginx   dashboard.com   localhost   80      34m

调试后我发现了这个。 “如果你是 运行 本地 Minikube,请使用 minikube ip 获取外部 IP。入口列表中显示的 IP 地址将是内部 IP”。

运行 这个命令

minikube ip
XXX.XXX.64.2

在主机文件中添加这个ip,之后我就可以访问dashboard.com