adamant-kite-43734
06/07/2023, 7:53 PMlemon-bear-35731
06/07/2023, 9:00 PMlemon-bear-35731
06/07/2023, 10:19 PMlemon-bear-35731
06/07/2023, 11:44 PMkubectl --kubeconfig cluster.yaml proxy
I copied the api server certificate and key /var/lib/rancher/rke2/server/serving-kube-apiserver.(crt|key)
over to the agent node and configured stunnel to listen on 127.0.0.1:6443 and proxy to 127.0.0.1:8001 where kubectl proxy was listening. I used docker to do this but sadly I missed retaining the command.
I then made the kubeconfig files under /var/lib/rancher/rke2/agent immutable chmod +i *.kubeconf
lemon-bear-35731
06/07/2023, 11:52 PMkubectl --kubeconfig cluster.yaml proxy
I changed the port that rke2 agent uses for load balancing to 8444 by editing /etc/systemd/system/multi-user.target.wants/rke2-agent.service
to add --lb-server-port 8444
This causes rke2 agent's non-working LB to avoid grabbing ports 6444/6443 as we want a working api server on 6443.
I copied the api server certificate and key /var/lib/rancher/rke2/server/serving-kube-apiserver.(crt|key)
over to the agent node and configured stunnel to listen on 127.0.0.1:6443 and proxy to 127.0.0.1:8001 where kubectl proxy was listening. I used docker to do this but sadly I missed retaining the command.
I then made the kubeconfig files under /var/lib/rancher/rke2/agent immutable so that rke2 agent would not clobber them when starting up and change them to a different port. chmod +i *.kubeconfig
When rke2 agent complained that it could not open them, I had to remove the immutable flag and immediately put it back, but this allowed the rke2 agent service to start and all of its containers to have connectivity to the api server.