behaviour dissapered after a second reboot.. chang...
# umh-support
d
behaviour dissapered after a second reboot.. change my ip to static but not the certificate for the cluster is not valid
eb 14 20:06:30 flatcar-1-umh k3s[720]: time="2023-02-14T20:06:30.270798502Z" level=info msg="Cluster-Http-Server 2023/02/14 20:06:30 http: TLS handshake error from 192.168.3.175:63853: remote error: tls: bad certificate" Feb 14 20:06:31 flatcar-1-umh k3s[720]: time="2023-02-14T20:06:31.303619711Z" level=info msg="Failed to test data store connection: this server is a not a member of the etcd cluster. Found [flatcar-1-umh-f3d95ce2=https://192.168.3.236:2380], expect: flatcar-1-umh-f3d95ce2=192.168.3.22" Feb 14 20:06:32 flatcar-1-umh k3s[720]: time="2023-02-14T20:06:32.540043157Z" level=info msg="certificate CN=k3s,O=k3s signed by CN=k3s-server-ca@1676400624: notBefore=2023-02-14 18:50:24 +0000 UTC notAfter=2024-02-14 20:06:32 +0000 UTC" Feb 14 20:06:32 flatcar-1-umh k3s[720]: time="2023-02-14T20:06:32.547273042Z" level=info msg="Cluster-Http-Server 2023/02/14 20:06:32 http: TLS handshake error from 192.168.3.175:63858: remote error: tls: bad certificate"
j
this happens if the IP changed from the IP during the installation
apparently it was installed with 192.168.3.236 and now has .3.22
i could check tomorrow if there is a way to fix it afterwards
d
yes. i have tried to rotated the certificates but no luck.. tried update ca with no luck..
when i change back to dhcp it works again.
j
There is a k3s setting called nodeIP or something
With this you can change the IP of the certificate during the installation.
Maybe this also works afterwards?
d
yes i was looking at that.. there is both nodeIP and externalNodeIP
j
It is --tls-san
So your goal is to change the IP address that you got via DHCP during installation to a different static ip correct?
d
yes since i want to have a static ip for the vm.
j
You could search for the systemd file that starts k3s during boot and append there the --tls-San thing
Better
Check out this
There is even a tls-san example
Ah ok, it is only executed during install
d
yes.. i have been looking at that one.
j
/etc/systemd/system/k3s.service.env /etc/systemd/system/k3s-agent.service.env
These ones
d
the agent i don't have. i will try the server and change my ip
j
A server is mostly also running the agent
It will pass through the arguments
d
seems not to work. i tried both the ip and https://ip
i will try to rotate the certificates again
no.. it will not rotate since the node is not in the etcd
j
@Ferdinand I am currently in homeoffice and do not have a K300. Can you try to replicate the problem and think of a potential fix?
f
Yes, found an unrelated iPXE error that i have to fix first. (Our server has 2 network cards, and it only tries to do DHCP on net0, instead of the connected net1)
replicated
So, to fix it, try this: 1) SSH into the server 2) Edit the /etc/systemd/system/k3s.service add --tls-san=XXX.YYY.ZZZ.AAA to the ExecStart options (see image) 3) Delete the old secret
sudo kubectl -n kube-system delete secrets/k3s-serving
4) Remove the cert from disk
mv /var/lib/rancher/k3s/server/tls/dynamic-cert.json /tmp/dynamic-cert.json
5) Restart k3s
systemctl restart k3s
Tested on flatcar k3s version v1.21.5+k3s2 (724ef700) go version go1.16.8
@Jermuk ill write a notion article for it
j
Very nice! @DanielH
d
nice. i did all the steps except i did not deleted the secret.. Did you do this before changing the ip ?
f
I deleted the secret before restarting k3s
I also added the "development" option inside the article, to just ignore certificate errors
d
yes, but i mean if you deleted the certs and stuff before changing the ip on eth0?
because if i change the ip and restart the network to apply the changes i can not access the cluster with kubectl to remove the secret, so i guess this operation needs to be performed before changing the ip
f
Can't you SSH into it after changing the IP ?
All of these commands where executed on the server
d
yes i can ssh in to the server after changing ip but i could not access the cluster with kubectl
the cluster could not start correct since the tls handshake failed.
f
Not even from flatcar itself ?
d
no.
i also tried to delete the node before changing the ip but still same result
i still get the same problem.
i have however fewer errors now.
now i can not access my cluster
Failed to test data store connection: this server is a not a member of the etcd cluster. Found [flatcar-1-umh-d175f0b5=https://192.168.3.238:2380], expect: flatcar-1-umh-d175f0b5=192.168.3.22"
j
@Ferdinand can you check it tomorrow?
f
still trying to reproduce your new error
d
did you use a different method to set static ip ?
f
I used Static IP via DHCP reservation, but currently setting up an server, to use the flatcar method
replicated your error
well, i managed to "fix" the error, but in doing so wiped my UMH cluster
:/
d
nice.. 😄
i tried to delete the cluster and rotate the certificates and then start up the cluster again but it did not help.. i have spent alot of time to trying to fix this problem..
nothing new here?
j
As far as I remember, he spend almost a day trying to troubleshoot it. For now, it is only possible to initially set the IP during the installation (not after the installation), but it is not exposed yet to the user to be changed. For now, you could configure your DHCP server to use static leases, so to give the same IP always to the same device. I think this is the only option for now :/ We can expose the static IP installation to the user, but it might take a couple of days / weeks. @Ferdinand We could add the "static IP" option in iPXE, which allows you to configure it via iPXE, and then it chainloads it into flatcar as well (as far as I remember there are variables in iPXE similar to serial number).
d
yes i have also spent almost a day to try to fix it seems the problem is that parts of the old configuration is still left even after resetting secrets and rotating certificates...
if i understand it should be able to reset the cluster but due to a bug in k3s it fails to remove the old cluster but this seems to be fixed with version 1.23 https://github.com/k3s-io/k3s/issues/4870
i am currently pulling an update.. i also notice that the upgrade-controller was not included with the flatcar installation..
YES!. finally..
So now i have a very easy solution to this problem..
1. first your update k3s to minimum v. 1.23. i used version: v1.26.1-k3s1 .. follow this guide https://docs.k3s.io/upgrades/automated
3. once your ip is changed, ssh back to the server using the new ip
4. stop k3os with: sudo systemctl stop k3s
5. reset the cluster etcd with: sudo /opt/bin/k3s server --cluster-reset
6. start k3s again: sudo systemctl starts k3s
7. check status of server: sudo systemctl status k3s
8. change the ip for the cluster in the lens config..
BOM! you have successfully changed your server to static IP.
i have not double checked that nothing gets affected since my installation is fresh, but i think you guys can manage that part.. i guess it should be quite easy to write a small script that sets the static ip and reset the cluster.
i wrote a small script that handles the ip change.. just change chmod to +xu and run it in sudo.. i have change ip 2 times now and it seems to work but there are now guaranties. Also maybe add some wait time after changing ip before running the rest and some feedback from the cluster reset before starting the cluster again.
it looks like it leaves some backups when doing this so i guess one should add some cleaning in /var/lib/rancher/k3s/ i also saw something about taking a backup first and then reset the cluster using the backup..
f
@Jermuk We should also include this in our installation process.
Yes, ill will check that.
d
the script i attached works but i think you need to have some wait time before running the cluster rested to allow the system to change the ip first and you also need to check if you should use some backup settings to avoid leaving old data.
j
Look what I have found in the documentation while re-structuring it 😆 😭 https://learn.umh.app/guides/getstarted/installation/adding-helm-repo-lens/#what-to-do-on-error-proxing-request
We make it easier to find in the new documentation: https://knowledge-3.ghost.io/course/how-to-fix-error-while-proxying-request-x509-certificate-is-valid-for-error/ (sneak preview only 🙂 )
2 Views