0
votes

I want to assign a static (i.e. non-ephemeral) regional IP to a Kubernetes service. Currently the service is of type "LoadBalancer", which GCP exposes as a regional TCP load balancer. By default the IP address of the forwarding rule is ephemeral. Is there any way I can use an existing static ip or to assign my own address by name (as is possible with Ingress/HTTP(S) Load Balancer)?

I have also tried to create my own forwarding rule with a custom static regional IP using the NodePort of the service. I have only succeeded to build the forwarding rule using the actual NodePort, but how does the Kubernetes/GCP-magic work that maps port 80 to the NodePort when using type "LoadBalancer"?

1
Please update your question with your configuration steps and deployment files. Also, have a look at the documentation cloud.google.com/kubernetes-engine/docs/how-to/… and cloud.google.com/load-balancing/docs/https/….Serhii Rohoza

1 Answers

1
votes

I have found a way to set the static IP. After that I needed to delete the service object and re-create it.

- apiVersion: v1
  kind: Service
  spec:
    loadBalancerIP: '<static ip>'

But the second part of my question I am still curious about