<p>In the Rancher I can see the amount of pods I have in the cluster and the total amount I can have.
How can I get this maximum amount of pods that my cluster is able to have with prometheus?</p>
<p><a href="https://i.stack.imgur.com/UELoO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UELoO.png" alt="Rancher example" /></a></p>

<p>You can use visualise based on these two queries</p>
<p><strong>Total allocable pods:</strong></p>
<pre><code>sum(kube_node_status_allocatable {resource=&quot;pods&quot;})
</code></pre>
<p>you can also cross-verify the result</p>
<pre><code>capacity=$(k get node $(k get node | awk '{if (NR==2) print $1}') -ojsonpath='{.status.capacity.pods}{&quot;\n&quot;}')
$capacity*number-of-nodes
</code></pre>
<p><a href="https://github.com/kubernetes/kube-state-metrics/blob/master/docs/node-metrics.md" rel="nofollow noreferrer">Node Metrics</a></p>
<p><strong>Total running pods:</strong></p>
<pre><code>sum(kube_pod_status_ready)
</code></pre>
<p>cross verification</p>
<pre><code> k get pods -A | wc
</code></pre>
<p><a href="https://github.com/kubernetes/kube-state-metrics/blob/master/docs/pod-metrics.md" rel="nofollow noreferrer">pod-metrics</a></p>
<p>So you can visualise this in Grafana</p>
<p><a href="https://i.stack.imgur.com/5cXwY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5cXwY.png" alt="enter image description here" /></a></p>
