Hm, I guess you didn't ask about editting the Pod, just creating it.
Anyway, moving the volumes section under the Spec should fix you up.

On Fri, Sep 16, 2016 at 2:08 PM, Cole Mickens <cole.mick...@gmail.com>
wrote:

> You've added the volume at the wrong place. It needs to be underneath the
> spec. It's currently a layer too high (under the template).
>
> But, more importantly, you're not allowed to edit the Pod and add volumes.
> Here's the error you'll get:
>
>  * spec: Forbidden: pod updates may not change fields other than
> `containers[*].image` or `spec.activeDeadlineSeconds`
>
> On Fri, Sep 16, 2016 at 2:04 PM, Derek Mahar <derek.ma...@gmail.com>
> wrote:
>
>> How can I add volumes to a job pod?  Why does kubectl complain about the
>> following job specification?
>>
>> apiVersion: batch/v1
>> kind: Job
>> metadata:
>>   name: keystore-configmap-job
>> spec:
>>   template:
>>     metadata:
>>       name: keystore-configmap
>>     spec:
>>       containers:
>>         - name: keystore
>>           image: ubuntu
>>           volumeMounts:
>>             - name: keystore-configmap-volume
>>               mountPath: /config-base64
>>               command: [ "sh", "-c", "cat /config-base64/keystore.jks |
>> base64 --decode | sha256sum" ]
>>
>>       restartPolicy: Never
>>
>>     volumes:
>>     - name: keystore-configmap-volume
>>       configMap:
>>         name: keystore-configmap
>>
>> derek@derek-HP-EliteOne-800-G1-AiO:~/Projects/keystore-configmap$
>> kubectl create -f keystore-configmap-job.yaml
>> error validating "keystore-configmap-job.yaml": error validating data: [found
>> invalid field command for v1.VolumeMount, found invalid field volumes for
>> v1.PodTemplateSpec]; if you choose to ignore these errors, turn
>> validation off with --validate=false
>>
>> Thank you,
>>
>> Derek
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Kubernetes user discussion and Q&A" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to kubernetes-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to kubernetes-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/kubernetes-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to