spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
securityContext:
capabilities:
add: ["NET_ADMIN", "SYS_TIME"]
To better understand the subject and the fields in yaml i wanted to see what fields can i add to "capabilities" by using : Kubectl explain pod.spec.securityContext.capabilities
i got nothing. "capabilities field does not exist" .
3.if for example i search for kubectl explain pod.spec.volumes and i get :
RESOURCE: volumes <[]Object>
the "[]" tells me that the next field will be a list and i will be adding '-' ?
AFAIK, the kubectl command covers all fields. The reason you got the error is that capabilities is on the containers security context spec not the pod security context spec The correct explain command is therefore
kubectl explain pod.spec.containers.securityContext.capabilities
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. kubectl explain pod.spec.securityContext
first to see available fields.
To answer question 3, yes [] implies an array and '-' is a way in to specify an array in yaml.