简体   繁体   English

Kubernetes (GKE) 上具有 nginx 入口的子域

[英]Sub-subdomain with nginx ingress on Kubernetes (GKE)

I have a domain at Cloudflare and some wildcards for subdomains我在 Cloudflare 有一个域和一些用于子域的通配符

在此处输入图像描述

which both point to the load balancer of an nginx ingress of a Kubernetes cluster (GKE) of the GCP.它们都指向 GCP 的 Kubernetes 集群 (GKE) 的 nginx 入口的负载均衡器。 Now, we have two pods and services running each (echo1 and echo2, which are essentially identical) and when I apply an ingress现在,我们有两个 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

I can reach echo2 under echo2.example.com, but not echo1.eu3.example.com.我可以到达 echo2.example.com 下的 echo2,但不能到达 echo1.eu3.example.com。 My question is how I can make the second one reachable as well.我的问题是如何使第二个也可以访问。

I can advise you to make some check.我可以建议你做一些检查。

Just set the Proxy status for "echo1.eu3.example.com" as DNS only.只需将“echo1.eu3.example.com”的代理状态设置为仅 DNS。 Then check the access.然后检查访问。 If ok - install certificates in kubernetes via cert manager.如果可以 - 通过证书管理器在 kubernetes 中安装证书。 We faced some times with this issue and resolved by using 3 deep domains.我们曾经遇到过这个问题,并通过使用 3 个深度域来解决。 For instance "echo1-eu3.example.com".例如“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 :)似乎 cloudfront 不喜欢这样的域 :) 当然,如果有人写了一个解决方案,如何在 cloudfront 中使用深层域 - 这对我们来说是个好习惯:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM