<p>One way to get the resource quota values in kubernetes is to use the following command </p>

<pre><code>&gt;kubectl describe resourcequotas
Name:                   default-quota
Namespace:              my-namespace
Resource                Used     Hard
--------                ----     ----
configmaps              19       100
limits.cpu              13810m   18
limits.memory           25890Mi  36Gi
</code></pre>

<p>But issue is this display all the values in text file format. Anyone knows how I can get in json format!</p>

<p>Of course, I can parse the output and get the individual entry and construct the json.  </p>

<pre><code>kubectl describe quota  | grep limits.cpu | awk '{print $2}'
13810m
</code></pre>

<p>But I am looking for something inbuilt or some quick way of doing it. Thanks for your help.</p>

<p>Thanks for your messages. Let me answer my own question, I have found one.</p>

<p><a href="https://stedolan.github.io/jq/" rel="nofollow noreferrer">jq</a> has solved my problem. </p>

<p><strong>To get the Max limit of resources in json format</strong></p>

<pre><code>kubectl get quota -ojson | jq -r .items[].status.hard
</code></pre>

<p><strong>To get the Current usage of resources in json format</strong></p>

<pre><code>kubectl get quota -ojson | jq -r .items[].status.used
</code></pre>
