How to fix "Error while proxying request: x509: certificate is valid for ..." error
Are you getting an Error while proxying request: x509: certificate is valid for ...
error in UMHLens / OpenLens after changing the IP address of your device? This is a common issue that can occur when the device's IP address changes from DHCP to static after installation. Fortunately, there are some easy ways to fix this error, and in this article, we'll walk you through two options.
Option 1: basically ignoring the cause (quickest)
If you get an error like this, you need to add insecure-skip-tls-verify: true
to the the cluster and remove the ca certificate, so it looks like the screenshot below.
Option 2: adjusting the IP address (permanent, flatcar only)
You can also set your static IP using the guide at https://www.flatcar.org/docs/latest/setup/customization/network-config-with-networkd/.
Once you've changed the IP address, SSH back to the server using the new IP. Follow these steps to reset the cluster and change the IP:
- Stop k3s with:
sudo systemctl stop k3s
- Reset the cluster etcd with:
sudo /opt/bin/k3s server --cluster-reset
- Start k3s again:
sudo systemctl start k3s
- Check the status of the server:
sudo systemctl status k3s
- Change the IP for the cluster in the lens config.
- Done! You have successfully changed your server to a static IP.
If you're unsure how to adjust the IP address, the article includes a small script from DanielH that can handle the change. Change the chmod
to +xu
and run it with sudo
. Note that there are no guarantees that it will work, so you may want to add some wait time after changing the IP before running the rest and some feedback from the cluster reset before starting the cluster again.