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 API (node/pod resource usage) #252

Closed
hjacobs opened this issue Mar 21, 2019 · 6 comments
Closed

Metrics API (node/pod resource usage) #252

hjacobs opened this issue Mar 21, 2019 · 6 comments
Assignees
Labels
kind/enhancement An improvement to existing functionality
Milestone

Comments

@hjacobs
Copy link
Contributor

hjacobs commented Mar 21, 2019

The Metrics Server (Resource Metrics API) is currently not set up, this is already mentioned as a to-do in the README:

Metrics API due to kube aggregation not being setup

Please add support for the Resource Metrics API (metrics.k8s.io/v1beta1 API version) to track node/pod resource usage and allow using kubectl top (#157) and tools like kube-ops-view.

K3s is awesome btw 😄

@reegnz
Copy link

reegnz commented Apr 2, 2019

Also realized today that the fact that metrics API is not present anything relying on HorizontalPodAutoscaling won't work either. :( That is something I ran into with trying to autoscale a deployment on k3s.

@hjacobs
Copy link
Contributor Author

hjacobs commented Apr 2, 2019

I had a similar issue with kind (Kubernetes in Docker), here how I deployed Metrics API: kubernetes-sigs/kind#398

@erikwilson
Copy link
Contributor

Metrics server should work with the latest RC, but needs some extra configuration.

To verify functionality k3s should run with a --kubelet-arg="address=0.0.0.0" flag, ex:

INSTALL_K3S_VERSION=v0.4.0-rc2 ./install.sh --kubelet-arg="address=0.0.0.0"

And install metrics server using our custom deployment from the root of this repo:

kubectl apply -f recipes/metrics-server

Then after a minute test metrics scraping:

kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes

Our goal is to continue improving k3s so a default deployment of metrics-server will work with the default arguments of k3s, this is being tracked in /issues/328.

@dnoland1
Copy link
Contributor

Works for me. Started up k3s using:

root@k3s-node1:~# k3s server --kubelet-arg="address=0.0.0.0"

Applied metrics-server manifests:

root@k3s-node1:~# k3s kubectl apply -f k3s/recipes/metrics-server/
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created
serviceaccount/metrics-server created
deployment.apps/metrics-server created
service/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created

Able to see pod and node metrics:

root@k3s-node1:~# k3s kubectl top node
NAME        CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
k3s-node1   40m          4%     350Mi           72%
root@k3s-node1:~# k3s kubectl top pod --all-namespaces
NAMESPACE     NAME                              CPU(cores)   MEMORY(bytes)
kube-system   coredns-857cdbd8b4-dl2bx          4m           11Mi
kube-system   helm-install-traefik-s8x6m        0m           0Mi
kube-system   metrics-server-675d76bcdb-6bc26   1m           14Mi
kube-system   svclb-traefik-6cf7794986-jdpd4    0m           1Mi
kube-system   traefik-55bd9646fc-d8bc9          4m           14Mi  

@erikwilson
Copy link
Contributor

Thanks for testing @dnoland1!

@hjacobs
Copy link
Contributor Author

hjacobs commented Apr 16, 2019

@erikwilson fix for the README: #355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement An improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

5 participants