尽管DNS级别相同的IP,但在GKE中的入口并没有相同的路由

发布于 2025-02-12 13:30:07 字数 2034 浏览 0 评论 0原文

我在GKE群集中设置了NGINX入口,如下所示:

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace nginx-ingress

带有IP的负载平衡器出现。

现在,我在Cloudflare上添加了两个指向该域的DNS:

app-a

kubectl create namespace app-a
kubectl label namespace app-a project=a

并在那里部署了一个应用程序:

apiVersion: v1
kind: Service
metadata:
  name: echo1
  namespace: app-a
spec:
  ports:
  - port: 80
    targetPort: 5678
  selector:
    app: echo1
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo1
  namespace: app-a
spec:
  selector:
    matchLabels:
      app: echo1
  replicas: 2
  template:
    metadata:
      labels:
        app: echo1
    spec:
      containers:
      - name: echo1
        image: hashicorp/http-echo
        args:
        - "-text=echo1"
        ports:
        - containerPort: 5678
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: echo-ingress-global
  namespace: app-a
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: "test.my-domain.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo1
              port:
                number: 80

镜头看起来不错,所以我想对其进行测试。

当我输入eu1.my-domain.com时,我得到

“在此处输入图像描述”

当然。

但是,当我输入test.my-domain.com时,我发现该网站是无法实现的:dns_probe_fined_nxdomain,尽管我希望看到虚拟应用程序的虚拟输出。

更奇怪的是,无论我是得到响应良好的结果还是未响应的结果,在Nginx控制器的日志中,任何呼叫都没有显示出来。

您能帮我,以便我可以访问test.my-domain.com主页吗?

I have setup in my GKE cluster an nginx ingress as follows:

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace nginx-ingress

A load balancer with its IP came up.

Now I added two DNS pointing to that domain at Cloudflare:

enter image description here

In addition I created a namespace app-a

kubectl create namespace app-a
kubectl label namespace app-a project=a

and deployed an app there:

apiVersion: v1
kind: Service
metadata:
  name: echo1
  namespace: app-a
spec:
  ports:
  - port: 80
    targetPort: 5678
  selector:
    app: echo1
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo1
  namespace: app-a
spec:
  selector:
    matchLabels:
      app: echo1
  replicas: 2
  template:
    metadata:
      labels:
        app: echo1
    spec:
      containers:
      - name: echo1
        image: hashicorp/http-echo
        args:
        - "-text=echo1"
        ports:
        - containerPort: 5678
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: echo-ingress-global
  namespace: app-a
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: "test.my-domain.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo1
              port:
                number: 80

Things look good in Lens, so I thought to test it out.

When I was entering eu1.my-domain.com, I get

enter image description here

which is intended, of course.

but when I entered test.my-domain.com, I get that the website is unreachable: DNS_PROBE_FINISHED_NXDOMAIN, although I expected to see the dummy output of the dummy app.

Even more strangely, no matter if I get the well-responding result or the non-responding one, in the logs of the nginx controller there is nothing showing up for any of the calls.

Can you help me, such that I can access the test.my-domain.com homepage?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文