05/25/2023, 9:51 AM
Hi team 👋 I was redirected from #rancher (kubernetes) channel. I have a specific question regarding how to access etcd data in a k3s cluster, any help would be appreciated! I set up k3s with High Availability Embedded etcd, and now trying to access etcd data following this instruction. However I get inconsistent results between etcd returned results and kubectl. What I’m trying to do is to get pods count in etcd using
etcdctl get --prefix --keys-only /registry/pods
, and it returns me 7 pods. When I get pods via kubectl across all namespaces, it gives me 8 pods. And the pods’ names don’t match.
I have 3 k3s server nodes:
# kubectl get node | grep erver
k3d-k3s-default-server-0   Ready    control-plane,etcd,master
k3d-k3s-default-server-1   Ready    control-plane,etcd,master
k3d-k3s-default-server-2   Ready    control-plane,etcd,master
And there’s one etcd runs directly at host port 2379:
# netstat -nplt | grep 2379
tcp        0      0 <|>*               LISTEN      2229051/k3s server
tcp        0      0*               LISTEN      2229051/k3s server
The pods data seems out-dated to me, and I wonder what should
Turned out the etcd was connected to another k3d cluster, issue solved!