I am using the flannel 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.
After I add the node using kubeadm I found out that the k get node xx -o yaml returns the flannel.alpha.coreos.com/public-ip annotation with the public IP address and which makes the internal Kubernetes pod unaccessible from other nodes.
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: <the-public-ip, not the internal one>
kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
node.alpha.kubernetes.io/ttl: "0"
volumes.kubernetes.io/controller-managed-attach-detach: "true"
I try to use k edit node xxx to change the public-ip in the annotation it works in just one minute and then it will change back to the original one.
So...my question is just like the title: How can I change the Kubernetes node annotation flannel.alpha.coreos.com/public-ip without modifying back?
Do the modification using kubectl and you will have two ways:
kubectl annotate:
kubectl annotate node xx --overwrite flannel.alpha.coreos.com/public-ip=new-value
or kubectl patch :
kubectl patch node xx -p '{"metadata":{"annotations":{"flannel.alpha.coreos.com/public-ip":"new-value"}}}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With