<pre><code>spec:
  containers:
  - image: nginx
    imagePullPolicy: IfNotPresent
    name: nginx
    securityContext: 
      capabilities: 
        add: ["NET_ADMIN", "SYS_TIME"] 
</code></pre>

<p>To better understand the subject and the fields in yaml i wanted to see what fields can i add to "capabilities" by using : <code>Kubectl explain pod.spec.securityContext.capabilities</code></p>

<p>i got nothing. "capabilities field does not exist" .</p>

<ol>
<li>1.how far does the explain command go ?</li>
<li>2.how can i find the fields i can add to let's say capabilities ?</li>
<li><p>3.if for example i search for kubectl explain pod.spec.volumes and i get :</p>

<p>RESOURCE: volumes &lt;[]Object> </p>

<p>the  "[]" tells me that the next field will be a list and i will be
adding '-' ?</p></li>
</ol>

Valentin Bichok
<p>AFAIK, the kubectl command covers all fields. The reason you got the error is that capabilities is on the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/#securitycontext-v1-core" rel="nofollow noreferrer">containers security context spec</a> not the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/#podsecuritycontext-v1-core" rel="nofollow noreferrer">pod security context spec</a> 
The correct explain command is therefore </p>

<p><code>kubectl explain pod.spec.containers.securityContext.capabilities</code></p>

<p>You can browse through API Reference instead of using explain if you are in doubt of the existing fields or use explain one step at a time. i.e. <code>kubectl explain pod.spec.securityContext</code> first to see available fields. </p>

<p>To answer question 3, yes [] implies an array and '-' is a way in to specify an array in yaml.</p>
