0

I have deployment my kubernetes cluster using kubeadm.

Now I want to gather cluster based information like master node IP, port on which apiserver is listening and name of the cluster.

With kubectl cluster-info gives me some data but I am looking to fetch cluster level information with the help of K8s rest API.

One way which i have tried is look for apiserver pod and get the data. It's giving me cluster level data but I need some other cleaner way of doing it.

Thanks in advance!

Abhay Dwivedi
  • 1,500
  • 2
  • 16
  • 22

1 Answers1

0

If you have ran the apiserver, you can access the kubernetes REST API on port 8001.

One way to expose it is like this :

sudo kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='^*$'&

then you can visit http://YOUR_VM_IP:8001/api

there you can see all the list of APIs and all the information you want.

Anshul Jindal
  • 368
  • 2
  • 17