4

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?

1
  • Delete and Re-deploy the flannel from the yaml manifest with correct annotation Commented Oct 20, 2018 at 9:26

2 Answers 2

4

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"}}}'
    
Sign up to request clarification or add additional context in comments.

Comments

2

Update annotation flannel.alpha.coreos.com/public-ip-overwrite and then redeploy the pod make this work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.