Search code examples
kubernetesgoogle-cloud-platformcloudgoogle-vpchyper-virtualization

Which scenario can detach a static external IP from a VM in GCP


I created a static IP in VPC network and attached it to a VM as the external IP address.

enter image description here

However, two weeks after the assignment of the static IP to the VM, I noticed that the static IP was automatically detached from the VM and I had to attached the IP there again.

What are the circumstances which lead to such a detachment If my VMs are of standard machine types? Can Kubernetes upgrade do this?


Solution

  • Although you can assign static IPs to nodes in a GKE cluster, these will be automatically detached if the node gets recreated (either, by autoscaling or node repair).

    In theory, Kubernetes/GKE are systems with dynamic resources, not supposed to preserve state (in most cases). If you want to add a static way to access the cluster, rather use Load Balancer or Ingress objects.

    In the scenario where you need to have a unified outbound address, you can use GKE with Cloud NAT to "unify" the dynamic node IPs for outbound connections.