我想使用 NGINX Ingress Controller 公开一个 Web 应用程序。
$ kubectl version
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2
NGINX Ingress 控制器版本为 3.4.3
我搜索了一下这些版本应该是兼容的。
我按照 https://docs.nginx.com/nginx-ingress-controller/installation/installing-nic/installation-with-manifests/ 上的入口控制器安装进行操作,选择通过清单安装(因为我更习惯使用给他们)和 NodePort 类型的服务。
$ kubectl apply -f deployments/common/ns-and-sa.yaml
$ kubectl apply -f deployments/rbac/rbac.yaml
$ kubectl apply -f deployments/common/nginx-config.yaml
$ kubectl apply -f deployments/common/ingress-class.yaml
$ kubectl apply -f deployments/deployment/nginx-ingress.yaml
$ kubectl create -f deployments/service/nodeport.yaml
检查后
kubectl get all --all-namespaces
我注意到 nginx-ingress pod 上有以下内容:
NAMESPACE NAME READY STATUS RESTARTS AGE
nginx-ingress pod/nginx-ingress-755bf8968b-tmdps 0/1 Running 0 76m
之后我运行了
kubectl describe pod nginx-ingress-755bf8968b-tmdps -n nginx-ingress
,结果显示:
Warning Unhealthy 4m21s (x4549 over 79m) kubelet Readiness probe failed: HTTP probe failed with statuscode: 503
我还检查了 pod 上的标签 app=nginx-ingress ,它是正确的。
kubectl logs -l app=nginx-ingress -n nginx-ingress
的输出:
W0326 16:09:12.078133 1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.VirtualServer: the server could not find the requested resource (get virtualservers.k8s.nginx.org)
E0326 16:09:12.078276 1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.VirtualServer: failed to list *v1.VirtualServer: the server could not find the requested resource (get virtualservers.k8s.nginx.org)
W0326 16:09:32.474319 1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.VirtualServerRoute: the server could not find the requested resource (get virtualserverroutes.k8s.nginx.org)
E0326 16:09:32.474345 1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.VirtualServerRoute: failed to list *v1.VirtualServerRoute: the server could not find the requested resource (get virtualserverroutes.k8s.nginx.org)
W0326 16:09:39.265682 1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.TransportServer: the server could not find the requested resource (get transportservers.k8s.nginx.org)
E0326 16:09:39.265849 1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.TransportServer: failed to list *v1.TransportServer: the server could not find the requested resource (get transportservers.k8s.nginx.org)
W0326 16:09:48.080045 1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
E0326 16:09:48.080101 1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
W0326 16:09:57.631094 1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.VirtualServer: the server could not find the requested resource (get virtualservers.k8s.nginx.org)
E0326 16:09:57.631121 1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.VirtualServer: failed to list *v1.VirtualServer: the server could not find the requested resource (get virtualservers.k8s.nginx.org)
我能做什么?按照教程和文档进行安装应该不会有任何复杂的情况。