- 集群类型:基于OpenNebula的裸机集群
- 规格:4 个工作节点,每个工作节点 8 个 CPU,每个工作节点 32GB 内存/RAM
我正在尝试使用以下命令为我的集群设置 NGINX 入口控制器:
[root@onekube-ip-193-144-35-177 ~]# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/baremetal/deploy.yaml
这给了我这个输出
namespace/ingress-nginx unchanged serviceaccount/ingress-nginx unchanged configmap/ingress-nginx-controller configured clusterrole.rbac.authorization.k8s.io/ingress-nginx unchanged clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx unchanged role.rbac.authorization.k8s.io/ingress-nginx unchanged rolebinding.rbac.authorization.k8s.io/ingress-nginx unchanged service/ingress-nginx-controller-admission unchanged service/ingress-nginx-controller unchanged deployment.apps/ingress-nginx-controller created validatingwebhookconfiguration.admissionregistration.k8s.io/ingress-nginx-admission configured clusterrole.rbac.authorization.k8s.io/ingress-nginx-admission unchanged clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx-admission unchanged job.batch/ingress-nginx-admission-create unchanged job.batch/ingress-nginx-admission-patch unchanged role.rbac.authorization.k8s.io/ingress-nginx-admission unchanged rolebinding.rbac.authorization.k8s.io/ingress-nginx-admission unchanged serviceaccount/ingress-nginx-admission unchanged
然后我使用以下命令编辑 ingress-nginx-controller 服务:
kubectl edit svc -n ingress-nginx ingress-nginx-controller
我在 externalIPs 下添加了 K8S 集群的外部 IP,具体如下:
[...]
spec:
clusterIP: 10.99.1.223
externalIPs:
- 193.144.35.177
externalTrafficPolicy: Cluster
ports:
[...]
为了测试 NGINX 入口控制器是否正常工作,我现在应该能够浏览指向 K8S 集群 IP 地址的子域(例如 prometheus.grapevine-project.eu)(由 DNS 查找确认),并且"404 Not Found page"
如果控制器确实已正确设置,则URL 应包含NGINX 入口控制器返回的值。但是,我目前正在"This site can’t be reached prometheus.grapevine-project.eu took too long to respond."
我的 Internet 浏览器上获取一个页面。
这是测试 NGINX 是否正常工作的正确/推荐方法吗?我的 NGINX 入口控制器设置有什么问题吗?
附言
[root@onekube-ip-193-144-35-177 ~]# kubectl get svc -n ingress-nginx ingress-nginx-controller -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
ingress-nginx-controller NodePort 10.105.197.205 193.144.35.177 80:30498/TCP,443:30781/TCP 14d app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx