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

<p><a href="https://i.stack.imgur.com/t75gY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t75gY.png" alt="enter image description here"></a></p>

<p>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.</p>

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

Charlie
<p>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).</p>

<p>In theory, Kubernetes/GKE are systems with dynamic resources, not supposed to preserve <a href="https://en.wikipedia.org/wiki/State_(computer_science)" rel="nofollow noreferrer">state</a> (in most cases). If you want to add a static way to access the cluster, rather use <a href="https://kubernetes.io/docs/concepts/services-networking/#loadbalancer" rel="nofollow noreferrer">Load Balancer</a> or <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress objects</a>. </p>

<p>In the scenario where you need to have a unified outbound address, you can use <a href="https://medium.com/google-cloud/using-cloud-nat-with-gke-cluster-c82364546d9e" rel="nofollow noreferrer">GKE with Cloud NAT</a> to "unify" the dynamic node IPs for outbound connections.</p>
