<p>My deployment is working fine. i just try to use local persistent volume for storing data on local of my application. after that i am getting below error.</p>
<blockquote>
<p>error: error validating &quot;xxx-deployment.yaml&quot;: error validating data: ValidationError(Deployment.spec.template.spec.imagePullSecrets[0]): unknown field &quot;volumeMounts&quot; in io.k8s.api.core.v1.LocalObjectReference; if you choose to ignore these errors, turn validation off with --validate=false</p>
</blockquote>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: xxx
  namespace: xxx
spec:
  selector:
    matchLabels:
      app: xxx
  replicas: 3
  template:
    metadata:
      labels:
        app: xxx
    spec:
     containers:
     - name: xxx
       image: xxx:1.xx
       imagePullPolicy: &quot;Always&quot;
       stdin: true
       tty: true
       ports:
       - containerPort: 80
       imagePullPolicy: Always
     imagePullSecrets:
     - name: xxx
       volumeMounts:
        - mountPath: /data
          name: xxx-data
     restartPolicy: Always
     volumes:
      - name: xx-data
        persistentVolumeClaim:
          claimName: xx-xx-pvc
</code></pre>

Dharmendra jha
<p>You need to move the <code>imagePullSecret</code> further down. It's breaking the container spec. <code>imagePullSecret</code> is defined at the pod spec level while <code>volumeMounts</code> belongs to the container spec</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: xxx
  namespace: xxx
spec:
  selector:
    matchLabels:
      app: xxx
  replicas: 3
  template:
    metadata:
      labels:
        app: xxx
    spec:
     containers:
     - name: xxx
       image: xxx:1.xx
       imagePullPolicy: &quot;Always&quot;
       stdin: true
       tty: true
       ports:
       - containerPort: 80
       imagePullPolicy: Always
       volumeMounts:
        - mountPath: /data
          name: xxx-data
     imagePullSecrets:
     - name: xxx
     restartPolicy: Always
     volumes:
      - name: xx-data
        persistentVolumeClaim:
          claimName: xx-xx-pvc
</code></pre>
