<p>I am using the <code>flannel</code> network plugin in my k8s cluster. And there is one special node which has one internal IP address and one public ip address which make it possible to ssh into it. </p>

<p>After I add the node using <code>kubeadm</code> I found out that the <code>k get node xx -o yaml</code> returns the <code>flannel.alpha.coreos.com/public-ip</code> annotation with the public IP address and <strong>which makes the internal Kubernetes pod unaccessible from other nodes</strong>.</p>

<pre><code>apiVersion: v1
kind: Node
metadata:
  annotations:
    flannel.alpha.coreos.com/backend-data: '{"VtepMAC":"xxxxxx"}'
    flannel.alpha.coreos.com/backend-type: vxlan
    flannel.alpha.coreos.com/kube-subnet-manager: "true"
    flannel.alpha.coreos.com/public-ip: &lt;the-public-ip, not the internal one&gt;
    kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
    node.alpha.kubernetes.io/ttl: "0"
    volumes.kubernetes.io/controller-managed-attach-detach: "true"
</code></pre>

<p>I try to use <code>k edit node xxx</code> to change the <code>public-ip</code> in the annotation it works in just one minute and then it will change back to the original one.</p>

<p>So...my question is just like the title: How can I change the Kubernetes node annotation <code>flannel.alpha.coreos.com/public-ip</code> without modifying back?</p>

<p>Do the modification using <code>kubectl</code> and you will have two ways:</p>

<ul>
<li><p><strong>kubectl annotate</strong>: </p>

<pre><code>kubectl annotate node xx --overwrite flannel.alpha.coreos.com/public-ip=new-value
</code></pre></li>
<li><p>or <strong>kubectl patch</strong> : </p>

<pre><code>kubectl patch node xx -p '{"metadata":{"annotations":{"flannel.alpha.coreos.com/public-ip":"new-value"}}}'
</code></pre></li>
</ul>
