kubernetesgoogle-cloud-platformterraformgoogle-kubernetes-enginegoogle-vpc

Assign internal static IP addresses to 2 pods of same statefulsets GKE GCP


I have two pods of the same statefulset in GKE GCP. They are assigned IP addresses from a secondary ip address range, I want them to expose the using 2 individual static ip addresses from primary ip address range of VPC. How can I do that ? Please note using cluster_ipv4_cidr_block in ip_allocation_policy of VPC native cluster is not an option since the size of subnet of primary ip address is smaller than required. What other ways I can achieve this ? Note- I do not want to load balance traffic, one pod will be the active node and the other is passive.


Solution

  • GKE internal load balancer with annotations solves this.