Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics-server endpoint #474

Closed
P6rguVyrst opened this issue Mar 6, 2018 · 2 comments
Closed

metrics-server endpoint #474

P6rguVyrst opened this issue Mar 6, 2018 · 2 comments

Comments

@P6rguVyrst
Copy link

Couldn't get an email contact so I'll ask here.
Is querying Kubernetes metrics-server supported in the client?
For example endpoint like this: /apis/metrics.k8s.io/v1beta1/namespaces/{namespace}/pods/{name}

@P6rguVyrst
Copy link
Author

Anwsered in 528

api_client = ApiClient()
response = api_client.call_api('/apis/metrics.k8s.io/v1beta1/pods/', 'GET', preaload_content=False)
print(response.text) # raw HTTPResponse

https://github.com/kubernetes-client/python/blob/master/kubernetes/client/api_client.py#L278

@darkdragn
Copy link

In case someone else finds this, another viable alternative is:

from kubernetes.config import load_kube_config                     
from kubernetes.client import CustomObjectsApi                                 
load_kube_config()
cust = CustomObjectsApi()
cust.list_cluster_custom_object('metrics.k8s.io', 'v1beta1', 'nodes')
cust.list_cluster_custom_object('metrics.k8s.io', 'v1beta1', 'pods')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants