k3s-io / k3s

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

[Release-1.30] - Support for NodeExternalDNS #10855

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=647fc892dbce192a603ce0fcfde57445e7d4a4c4

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-2-2-2-98       Ready    control-plane,etcd,master   8m21s   v1.30.5+k3s-647fc892

Config.yaml:

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

Validation

``` $ 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=647fc892dbce192a603ce0fcfde57445e7d4a4c4 $ 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","2.2.2.98","--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"]'