Search code examples
kubernetesgoogle-cloud-platformnetwork-trafficgoogle-kubernetes-engine

Kubernetes cluster outgoing traffic IP


I have a Kubernetes cluster on Google Kubernetes Engine. I want to assign a static IP for all outgoing traffic of a cluster.

I already have reserved external IPs but I can't assign them to a cluster with the GCP console.

I found a solution to do it with the cli : Static outgoing IP in Kubernetes

but it targets the VM and I will need to set it each time I deploy. So it's not targeting the cluster.

Can anybody provide any pointers? Thanks.


Solution

  • GKE currently doesn't have an option to create the cluster with all your nodes using a reserved public IP. All you get in advanced networking options is something like this:

    advanced network k8s

    You will have to use the gcloud API that you mentioned which should be easy to put in a script.

    Or you can also use the UI by editing the instance(s) and going into 'Network Interfaces' like this:

    network