<p>I want to access limits.memory variable returned by get command in k8s</p>

<pre><code>kubectl get resourcequota default -n 103000-p4-dev -o custom-columns=USED:.status.used
USED
map[limits.memory:0 requests.cpu:0 requests.memory:0]
</code></pre>

<p>I tried many ways but couldn't succeed</p>

<pre><code>[root@iaasn00126847 ~]# k get resourcequota default -n 103000-p4-dev -o custom-columns=USED:.status.used.limits.memory
</code></pre>

<p>returns nothing</p>

<p>Is there a delimiter to fetch the same</p>

prashant
<p>Try with <a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="noreferrer">jsonpath</a></p>

<pre><code>kubectl get resourcequota default -n 103000-p4-dev  -o jsonpath="{.status.used.limits\.memory}"
</code></pre>

<p>This is what I tried</p>

<pre><code>$ kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml
resourcequota/mem-cpu-demo created
$ kubectl get resourcequota
NAME           CREATED AT
mem-cpu-demo   2019-10-09T06:38:39Z
$ 
$ kubectl get resourcequota mem-cpu-demo -o json
{
    "apiVersion": "v1",
    "kind": "ResourceQuota",
    "metadata": {
        "annotations": {
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"ResourceQuota\",\"metadata\":{\"annotations\":{},\"name\":\"mem-cpu-demo\",\"namespace\":\"default\"},\"spec\":{\"hard\":{\"limits.cpu\":\"2\",\"limits.memory\":\"2Gi\",\"requests.cpu\":\"1\",\"requests.memory\":\"1Gi\"}}}\n"
        },
        "creationTimestamp": "2019-10-09T06:38:39Z",
        "name": "mem-cpu-demo",
        "namespace": "default",
        "resourceVersion": "975",
        "selfLink": "/api/v1/namespaces/default/resourcequotas/mem-cpu-demo",
        "uid": "0d74d782-b717-4845-a0da-424776c05d45"
    },
    "spec": {
        "hard": {
            "limits.cpu": "2",
            "limits.memory": "2Gi",
            "requests.cpu": "1",
            "requests.memory": "1Gi"
        }
    },
    "status": {
        "hard": {
            "limits.cpu": "2",
            "limits.memory": "2Gi",
            "requests.cpu": "1",
            "requests.memory": "1Gi"
        },
        "used": {
            "limits.cpu": "0",
            "limits.memory": "0",
            "requests.cpu": "0",
            "requests.memory": "0"
        }
    }
}
$
$ kubectl get resourcequota mem-cpu-demo -o jsonpath="{.status.used}"
map[limits.cpu:0 limits.memory:0 requests.cpu:0 requests.memory:0]$
$
$ kubectl get resourcequota mem-cpu-demo -o jsonpath="{.status.used.limits\.memory}"
0
$
$ kubectl get resourcequota mem-cpu-demo -o jsonpath="{.status.hard.limits\.memory}"
2Gi
$
</code></pre>
