Remote kubectl x509: certificate is valid for 127.0.0.1


E0829 10:19:51.734979   13883 memcache.go:265] couldn't get current server API group list: Get "https://x.x.x.x:6443/api?
Unable to connect to the server: tls: failed to verify certificate: x509: certificate is valid for 10.43.0.1, 127.0.0.1, 172.31.4.10, ::1, not 13.126.42.175


Solution:

edit /etc/systemd/system/k3s.service
ExecStart=/usr/local/bin/k3s \    server \       '–advertise-address=106.xx.xx.xx' \       '-tls-san=106.xx.xx.xx' \  ## this is important
and

kubectl -n kube-system delete secrets/k3s-serving mv /var/lib/rancher/k3s/server/tls/dynamic-cert.json /tmp/dynamic-cert.json systemctl restart k3s

Popular posts from this blog

Shrink you container size up to 95%.

alma linux: dnf Module yaml error: Unexpected key in data