[英]Kubernetes cluster outgoing traffic IP
I have a Kubernetes cluster on Google Kubernetes Engine. 我在Google Kubernetes Engine上有一个Kubernetes集群。 I want to assign a static IP for all outgoing traffic of a cluster.
我想为群集的所有传出流量分配一个静态IP。
I already have reserved external IPs but I can't assign them to a cluster with the GCP console. 我已经保留了外部IP,但是无法使用GCP控制台将其分配给群集。
I found a solution to do it with the cli : Static outgoing IP in Kubernetes 我找到了使用cli的解决方案: Kubernetes中的静态传出IP
but it targets the VM and I will need to set it each time I deploy. 但是它以VM为目标,因此每次部署时都需要对其进行设置。 So it's not targeting the cluster.
因此,它不是针对集群的。
Can anybody provide any pointers? 有人可以提供任何指针吗? Thanks.
谢谢。
GKE currently doesn't have an option to create the cluster with all your nodes using a reserved public IP. GKE当前无法选择使用保留的公共IP与所有节点一起创建集群。 All you get in advanced networking options is something like this:
您在高级网络选项中所获得的一切都是这样的:
You will have to use the gcloud
API that you mentioned which should be easy to put in a script. 您将必须使用您提到的
gcloud
API,该API应该易于放置在脚本中。
Or you can also use the UI by editing the instance(s) and going into 'Network Interfaces' like this: 或者,您也可以通过编辑实例并进入“网络接口”来使用UI,如下所示:
I agree with something in the previous answer you can't do something like this directly in the cluster, but you can use another service to do what you are looking for: nat gateway that will use a fixe public ip. 我同意上一个答案中的某些内容,您不能在集群中直接执行此类操作,但是您可以使用其他服务来完成您要查找的操作:将使用fixe公共ip的nat网关。
For more security, you can even deploy the gateways in multiple zones to have some redundancy and your cluster will always have outgoing trafic go by the gateways. 为了提高安全性,您甚至可以将网关部署在多个区域中,以实现一定程度的冗余,并且您的群集将始终具有网关的传出流量。
I won't explain how it works here, because google already provided a tutorial to what you want to do here: https://cloud.google.com/solutions/using-a-nat-gateway-with-kubernetes-engine 我不会在这里解释它的工作方式,因为Google已经在此处提供了您要执行的操作的教程: https : //cloud.google.com/solutions/using-a-nat-gateway-with-kubernetes-engine
Enjoy. 请享用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.