raspberry pi – Accessing Remote Kubernetes Cluster via Kubectl

I have a K3s cluster running on a set of Raspberry Pi’s and when I log in to my master node and run the kubectl get nodes command, it fails:

my-user@k3s-cluster-master:~$ sudo kubectl get nodes
Unable to connect to the server: net/http: TLS handshake timeout

But when I tried to run it from my local machine, I get the same error message:

I0128 21:40:20.643719  285473 loader.go:375] Config loaded from file:  /home/my-user/.kube/config
I0128 21:40:20.651694  285473 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubectl/v1.18.6 (linux/amd64) kubernetes/dff82dc" 'https://192.168.0.100:6443/api?timeout=32s'
I0128 21:40:30.662009  285473 round_trippers.go:443] GET https://192.168.0.100:6443/api?timeout=32s  in 10010 milliseconds
I0128 21:40:30.662074  285473 round_trippers.go:449] Response Headers:
I0128 21:40:30.662200  285473 cached_discovery.go:121] skipped caching discovery info due to Get https://192.168.0.100:6443/api?timeout=32s: net/http: TLS handshake timeout
I0128 21:40:30.663148  285473 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubectl/v1.18.6 (linux/amd64) kubernetes/dff82dc" 'https://192.168.0.100:6443/api?timeout=32s'

I did copy the kube config and adapted the server ip which is 192.168.0.100 in my case, which is the IP address of my master node.

Here is the status of my k3s service on my master node:

joesan@m1:~$ sudo systemctl status k3s.service
● k3s.service - Lightweight Kubernetes
     Loaded: loaded (/etc/systemd/system/k3s.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-01-28 21:01:58 UTC; 5min ago
       Docs: https://k3s.io
    Process: 722 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS)
    Process: 733 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
   Main PID: 738 (k3s-server)
      Tasks: 74
     Memory: 575.1M
        CPU: 3min 12.782s

Is there something that I’m missing? I’m in need of some help to fix this.

Read more here: Source link