Are there any locations where I can see all pod's configuration scheduled on that workernode?
I would like to run some static checks on each worker nodes using Ansible to check if the pod's have been given enough resources (CPU/MEM), I have to explicitly run this job on worker node only and not through kubectl API call.
Thanks!
CodePudding user response:
You can try below command
crictl stats
if you are using docker as runtime then replace crictl with docker
CodePudding user response:
This command can be executed from any node or from a system which has access to the cluster. It gives the pods in all namespaces deployed in a particular node.
kubectl get pods -A -o wide --field-selector spec.nodeName=<nodename>
This will list all pods from all namespaces but you can narrow it down for specific namespace by the following command.
kubectl get pods -n ns -o wide --field-selector spec.nodeName=<nodename>
Replace ns with required namespace.
For requests and limits
kubectl describe nodes <node name>
kubectl get pods -o yaml
you can see the pods running on the node and their cpu and memory requests and limits.