Ingress 未在 minikube 1.23 和 Ubuntu 21.04 中设置 IP 地址

Ingress does not set IP-Adress in minikube 1.23 and Ubuntu 21.04

我正在学习一些 Kubernetes 并且在本教程的入口部分。 在那里,我不得不更改我的配置文件以进入更新版本的 Kubernes。到目前为止,这也开始得很好,但不幸的是,入口没有分配给我的主机 IP。 入口的原始文件如下所示

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dashboard-ingress
  namespace: kubernetes-dashboard
spec:
  rules:
  - host: dashboard.com
    http:
      paths:
      - backend:
          serviceName: kubernetes-dashboard
          servicePort: 80

我的调整如下:

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

如果我用“get”查看入口,我会得到以下结果

 kubectl get ingress -n kubernetes-dashboard  
NAME                CLASS    HOSTS           ADDRESS   PORTS   AGE
dashboard-ingress   <none>   dashboard.com             80      18m

并用 describe 得出以下结果

kubectl describe ingress -n kubernetes-dashboard  
Name:             dashboard-ingress
Namespace:        kubernetes-dashboard
Address:          
Default backend:  kubernetes-dashboard:80 (172.17.0.6:9090)
Rules:
  Host           Path  Backends
  ----           ----  --------
  dashboard.com  
                 /   kubernetes-dashboard:80 (172.17.0.6:9090)
Annotations:     <none>
Events:          <none>

当我查看来自 ingress pod 的日志时,这引起了我的注意

8 main.go:101] "successfully validated configuration, accepting" ingress="dashboard-ingress/kubernetes-dashboard"
I0917 14:56:01.607654       8 store.go:361] "Ignoring ingress because of error while validating ingress class" ingress="kubernetes-dashboard/dashboard-ingress" error="ingress does not contain a valid IngressClass"
E0917 14:56:11.341175       8 leaderelection.go:361] Failed to update lock: configmaps "ingress-controller-leader" is forbidden: User "system:serviceaccount:ingress-nginx:ingress-nginx" cannot update resource "configmaps" in API group "" in the namespace "ingress-nginx"

我做错了什么?

你好尼塞尔

这是一个已在 minikube 1.23.1 中报告并解决的错误。您必须将 minikube 更新到 1.23.1 并且入口将正常工作。