在Kubernetes上添加Nginx的子辅助因子(GKE)

发布于 2025-02-08 22:58:26 字数 1019 浏览 1 评论 0原文

我在Cloudflare有一个域,子域的一些通配符

”“在此处输入图像描述”

这两个都指向GCP的Kubernetes群集(GKE)的nginx的负载平衡器。现在,我们有两个运行的POD和服务(echo1和echo2,本质上是相同的),当我应用入口时,

kind: Ingress
metadata:
  name: echo-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: "echo1.eu3.example.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo1
              port:
                number: 80
  - host: "echo2.example.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo2
              port:
                number: 80

我可以在echo2.example.com下与echo2联系,而不是echo1.eu.eu3.example.com。我的问题是如何使第二个也可以到达。

I have a domain at Cloudflare and some wildcards for subdomains

enter image description here

which both point to the load balancer of an nginx ingress of a Kubernetes cluster (GKE) of the GCP. Now, we have two pods and services running each (echo1 and echo2, which are essentially identical) and when I apply an ingress

kind: Ingress
metadata:
  name: echo-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: "echo1.eu3.example.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo1
              port:
                number: 80
  - host: "echo2.example.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo2
              port:
                number: 80

I can reach echo2 under echo2.example.com, but not echo1.eu3.example.com. My question is how I can make the second one reachable as well.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉薄对峙 2025-02-15 22:58:26

我可以建议您进行一些检查。

只需将“ Echo1.eu3.example.com”的代理状态设置为DNS。然后检查访问。如果可以的话 - 通过Cert Manager在Kubernetes安装证书。我们面对这个问题,并通过使用3个深域解决了问题。例如“ echo1-eu3.example.com”。似乎云方面不喜欢这样的域::)当然,如果有人编写解决方案如何与云层中的深层域一起工作 - 对我们来说,这是一个很好的做法:)

I can advise you to make some check.

Just set the Proxy status for "echo1.eu3.example.com" as DNS only. Then check the access. If ok - install certificates in kubernetes via cert manager. We faced some times with this issue and resolved by using 3 deep domains. For instance "echo1-eu3.example.com". It seems cloudfront does not like such domains :) Of course if someone write a solution how to work with deep domains in cloudfront - it would be good practice for us :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文