k3s-io / k3s

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

[Release-1.29] - Support for NodeExternalDNS #10856

Open brandond opened 1 month ago

brandond commented 1 month ago

Backport fix for Support for NodeExternalDNS

VestigeJ commented 3 weeks ago

Environment Details

Validated using COMMIT=9de27e958abd062bd62821221e633fb7cbec6400

Infrastructure

Node(s) CPU architecture, OS, and version:

Linux 6.4.0-150600.23.17-default x86_64 GNU/Linux PRETTY_NAME="SUSE Linux Enterprise Server 15 SP6"

Cluster Configuration:

NAME               STATUS   ROLES                       AGE     VERSION
ip-3-3-3-42        Ready    control-plane,etcd,master   8m22s   v1.29.9+k3s-9de27e95

Config.yaml:

node-external-ip: 3.3.3.42
token: YOUR_TOKEN_HERE
write-kubeconfig-mode: 644
debug: true
cluster-init: true
node-external-dns:
- cloudflare.com
- google.com
- arc.k3s.com

Reproduction

``` $ curl https://get.k3s.io --output install-"k3s".sh $ sudo chmod +x install-"k3s".sh $ sudo groupadd --system etcd && sudo useradd -s /sbin/nologin --system -g etcd etcd $ sudo modprobe ip_vs_rr $ sudo modprobe ip_vs_wrr $ sudo modprobe ip_vs_sh $ sudo printf "on_oovm.panic_on_oom=0 \nvm.overcommit_memory=1 \nkernel.panic=10 \nkernel.panic_ps=1 \nkernel.panic_on_oops=1 \n" > ~/90-kubelet.conf $ sudo cp 90-kubelet.conf /etc/sysctl.d/ $ sudo systemctl restart systemd-sysctl $ COMMIT=9de27e958abd062bd62821221e633fb7cbec6400 $ sudo INSTALL_K3S_COMMIT=$COMMIT INSTALL_K3S_EXEC=server ./install-k3s.sh $ k apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml $ kgp dnsutils $ kgn -o yaml | grep -i dns $ k3s -v k exec -it dnsutils -- nslookup -debug cloudflare.com > cloudflare k exec -it dnsutils -- nslookup -debug google.com > google k exec -it dnsutils -- nslookup -debug arc.k3s.com > arc ``` **Results:** $ kgn -o yaml | grep -i dns ``` k3s.io/node-args: '["server","--node-external-ip","3.3.3.42","--token","********","--write-kubeconfig-mode","644","--debug","true","--cluster-init","true","--node-external-dns","cloudflare.com","--node-external-dns","google.com","--node-external-dns","arc.k3s.com"]' ```