Score:0

Passing the results of top into a kubernetes pod

de flag

Problem: I want to create a service which can clean up another service that only runs when the node and target pod is not under heavy load on a kubernetes cluster.

Solution: Unsure, I want to try and do something that involves passing the values of kubetctl top into a pod so it can decide what to do based on current load.

Is this possible or is there another solution?

Edit: I've been asked for more clarification. The pod in question will be an eventstore instance and want to run the scavange (clean up ) when CPU usage is low to prevent the clean up slowing the pod down. I want to make a piece of code that can query the load and decide when is a good time to run the clean up instead of an arbitrary timer / schedule.

in flag
Hi Mr Giggles welcome to S.F. Running `kubectl --v=3 top nodes` and its `top pod` friend will show exactly which APIs kubectl is invoking to get that answer. If you give the Pod's ServiceAccount a ClusterRoleBinding (and RoleBinding?) that allows it access to those same resources, I would expect it could get the same results at will
Mikolaj S. avatar
cn flag
What do you mean by "service which can clean up another service"? What is the meaning of the "service" in your example? Could clarify it - add some example of "cleaning up service"? Which Kubernetes version are you using? Are you using some cloud provider solution or bare-metal?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.