k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
26.62k stars 2.24k forks source link

--node-external-ip can not add annotate flannel.alpha.coreos.com/public-ip-overwrite #10037

Closed sunnoy closed 2 weeks ago

sunnoy commented 2 weeks ago

Environmental Info: K3s Version:

k3s version v1.29.3+k3s1 (8aecc26b) go version go1.21.8 Node(s) CPU architecture, OS, and Version:

Linux VM-8-2-centos 5.14.0-432.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Mar 20 20:26:59 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Cluster Configuration:

1 servers 1 agents Describe the bug:

curl -sfL https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn INSTALL_K3S_SELINUX_WARN=true K3S_SELINUX=false INSTALL_K3S_SKIP_SELINUX_RPM=true K3S_TOKEN=cncf INSTALL_K3S_VERSION=v1.29.3+k3s1 K3S_CLUSTER_INIT=true INSTALL_K3S_EXEC='--flannel-backend wireguard-native --flannel-external-ip --node-external-ip xxxxx --system-default-registry "registry.cn-hangzhou.aliyuncs.com" --disable-network-policy --disable servicelb,traefik,local-storage,metrics-server --disable-helm-controller --disable-cloud-controller' sh -

wg peer dont use node-external-ip's ip

Steps To Reproduce:

Expected behavior:

Actual behavior:

Additional context / logs:

ChristianCiach commented 2 weeks ago

I think --disable-cloud-controller could be the issue here. If I remember correctly, the K3s CCM seems to be responsible for setting the node-annotations (like the public ip overwrite) that Flannel uses.

Edit: Looks like I remember correctly: https://github.com/k3s-io/k3s/blob/94e29e2ef5d79904f730e2024c8d1682b901b2d5/pkg/agent/run.go#L368