有没有办法从 terraform 创建的静态 IP 资源(GCP)将 loadBalancerIP 注入到 kubernetes 入口?
我们使用 Terraform 创建所有基础设施资源,然后使用 Helm 在集群中部署应用程序。
我们正在寻找一种方法来简化基础设施和应用程序的创建,因此目前我们正在做的事情是:
- Terraform 创建 kubernetes 集群、VPC 网络等以及一些静态公共 IP 地址
- 我们必须等待这些的动态创建由 Terraform 完成静态 IP
- 我们找出已创建的公共 IP,并将其手动添加到入口控制器 helm 图表上的
loadBalancerIP:
规范中
如果可能的话,我想店铺通过 terraform 生成的公共 IP(配置映射会很好),然后在入口服务 loadBalancerIP:
规范中引用它,以便对端到端流程进行排序。
我知道 configmaps 用于 pod,但我不认为它们可以用于 kubernetes 服务对象 - 有人对我如何实现这一目标有任何想法/想法吗?
We use Terraform to create all of our infrastructure resources then we use Helm to deploy apps in our cluster.
We're looking for a way to streamline the creation of infra and apps, so currently this is what we do:
- Terraform creates kubernetes cluster, VPC network etc and a couple of static public IP addresses
- We have to wait for the dynamic creation of these static IPs by Terraform to complete
- We find out what the public IP is that's been created, and manually add that to our
loadBalancerIP:
spec on our ingress controller helm chart
If at all possible, I'd like to store the generated public IP somewhere via terraform (config map would be nice), and then reference that in the ingress service loadBalancerIP:
spec, so the end to end process is sorted.
I know configmaps are for pods and I don't think they can be used for kubernetes service objects - does anyone have any thoughts/ideas on how I could achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 terraform 在 GCP 中创建一个静态公共 IP,方法是指定您想要的名称,如下所示:
然后,您可以通过指定注释
kubernetes 在 Kubernetes 入口资源中引用此静态公共 IP
像这样:name
.io/ingress.global-static-ip-name: "the-name-you-want"这将在 GKE 中创建入口资源“example”并附加名为的静态公共 IP '你想要的名字'。
I suggest creating a static public IP in GCP using terraform by specifying the name you want like this:
You can then refer to this static public IP
name
in the Kubernetes ingress resource by specifying the annotationskubernetes.io/ingress.global-static-ip-name: "the-name-you-want"
like this:This will create ingress resource 'example' in GKE and attach static public IP named 'the-name-you-want' to it.