<p>i try to deploy a container but unfortunately i have an error when i try to execute <strong>kubectl apply -f *.yaml</strong></p>

<p>the error is : </p>

<blockquote>
  <p>error validating data: ValidationError(Pod.spec.containers[1]):
  unknown field "persistentVolumeClaim" in io.k8s.api.core.v1.Container;</p>
</blockquote>

<p>i dont understand why i get the error because i wrote  <strong>claimName:</strong> under <strong>persistentVolumeClaim:</strong> in my pd.yaml config :(</p>

<p><strong>Pod.yaml</strong></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: karafpod
spec:
  containers:
  - name: karaf
    image: xxx/karaf:ids-1.1.0
    volumeMounts:
    - name: karaf-conf-storage
      mountPath: /apps/karaf/etc
  - name: karaf-conf-storage
    persistentVolumeClaim:
      claimName: karaf-conf-claim
</code></pre>

<p><strong>PersistentVolumeClaimKaraf.yml</strong> </p>

<pre><code>kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: karaf-conf-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Mi
</code></pre>

<p>Deployment.yaml</p>

<pre><code> apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
   name: karaf
   namespace: poc 
 spec:
   replicas: 1
   template:
     metadata:
       labels:
         app: karaf
     spec:
       containers:
       - name: karaf
         image: "xxx/karaf:ids-1.1.0"
         imagePullPolicy: Always
         ports:
         - containerPort: 6443
         - containerPort: 6100
         - containerPort: 6101
         resources: 
         volumeMounts:
         - mountPath: /apps/karaf/etc
           name: karaf-conf
       volumes:
       - name: karaf-conf
         persistentVolumeClaim:
           claimName: karaf-conf
</code></pre>

<p>The reason you're seeing that error is due to you specifying a <code>persistentVolumeClaim</code> under your pod spec's container specifications. As you can see from the auto generated docs here: <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#container-v1-core" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#container-v1-core</a></p>

<p><code>persistentVolumeClaims</code> aren't supported at this level/API object, which is what's giving the error you're seeing.</p>

<p>You should modify the <code>pod.yml</code> to specify this as a volume instead.</p>

<p>e.g.:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: karafpod
spec:
  containers:
    - name: karaf
      image: xxx/karaf:ids-1.1.0
      volumeMounts:
      - name: karaf-conf-storage
        mountPath: /apps/karaf/etc
  volumes:
    - name: karaf-conf-storage
      persistentVolumeClaim:
        claimName: karaf-conf-claim
</code></pre>
