1 Answer
- Newest
- Most votes
- Most comments
1
With an EKS cluster, you can gather information in the EKS level or in the Kubernetes level. In the EKS level, you can use eksctl
tool or the Boto EKS Client, but at this level, you can only look into cluster/nodegroup information. What you want is node information. So you have to query at Kubernetes level. You could use kubectl tool to create your query. For example:
# list all nodes in the cluster with their labels
kubectl get nodes --show-labels
# list all nodes in a specific nodegroup
kubectl get node --selector='eks.amazonaws.com/nodegroup=x86-br-spot-xl'
If you want to do this in Python, you could use Kubernetes Python Client.
from kubernetes import client, config
# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()
k8s_api = client.CoreV1Api()
logger.info("Getting k8s nodes...")
response = k8s_api.list_node()
You should look into Kubernetes documentation on how to get all the info you want with kubectl and then translate it later to Python.
answered 2 years ago
Relevant content
- Accepted Answerasked 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 7 months ago
This makes sense. I was hoping I would be able to query it from the AWS console as it is in there to view.
I'll deep dive into using kubectl and see what I can do.
Thanks!