google-app-engine - Ingress with subdomains
问题描述
I use Google Cloud for deploy company app.
The goal: every branch deployed on some subdomain(example.com): task-123.example.com, etc.
I copy Cloud DNS namespace to the domain registrar. I pass the static IP address(via kubernetes.io/ingress.global-static-ip-name: "test-static-ip"
) for Ingress and pass it to domain registrar to A record. But I can't understand how to make subdomain works.
Every branch creates Ingress with static IP, but with different URLs for the host.
I made CNAME *.example.com which refers to example.com, but its not works.
Help me, please. Sorry for my English.
解决方案
You want *.example.com to point to the ingress controller so branch1.example.com and branch2.example.com will both hit the ingress controller. This is achieved with wildcard DNS.
Each branch in your scenario should have its own routing rule (ingress resource) with a host section defined for its specific branch. The ingress controller is updated when a new ingress resource is created and its routing rules then reflect the additional rule. So creating a new branch with a new ingress resource for that host will tell the ingress controller to route traffic for that specific host to a Service specific to that branch. (Or you can define all the branch rules in one go with a fanout ingress - see ingress-nginx - create one ingress per host? Or combine many hosts into one ingress and reload? )
That's 'how it works'. I'm not sure if that is your question though? It's hard to diagnose the problem you're having. Presumably you have an Ingress, a Service and a Deployment? To help with that I think you'd need to post those and explain (either as an update or a separate question) what behaviour you see (a 404 maybe)?
推荐阅读
- python - pandas read_html,当行中有数据时为什么说NaN
- javascript - 如何在 React Final Form 中重新运行验证
- html - 将小图像放在平移图像背景上
- regex - 如何根据正则表达式递归查找当前文件夹和子文件夹中的所有文件
- html - 为什么我的内容有两个边框?
- javascript - Swagger-jsdoc 不引用 yaml 文件
- android - 以编程方式将 Circular ProgressBar 设置为 TextView 的 Left Drawable
- git - 如何将应用到分支 A 的分支应用到分支 B
- groovy - groovy 检索 def 值并将其分配给特定位置
- javascript - 一起使用 flot 和 bootstrap