<p>I'm tying to create a deployment with 3 replicas, whcih will pull image from a private registry. I have stored the credentials in a secret and using the  imagePullSecrets in the deployment file. Im getting below error in the deploy it.</p>

<p>error: error validating "private-reg-pod.yaml": error validating data: [ValidationError(Deployment.spec): unknown field "containers" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec): unknown field "imagePullSecrets" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec): missing required field "template" in io.k8s.api.apps.v1.DeploymentSpec]; if you choose to ignore these errors, turn validation off with --validate=false</p>

<p>Any help on this?</p>

<p>Below is my deployment file :</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: test-pod-deployment
  labels:
    app: test-pod
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test-pod
  template:
    metadata:
      labels:
        app: test-pod
    spec:
      containers:
      - name: test-pod
    image: &lt;private-registry&gt;
  imagePullSecrets:
  - name: regcred
</code></pre>

<p>Thanks,
Sundar</p>

Sun
<p>Image section should be placed in container specification. ImagePullSecret should be placed in spec section so proper yaml file looks like this (please note indent):</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: test-pod-deployment
  labels:
    app: test-pod
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test-pod
  template:
    metadata:
      labels:
        app: test-pod
    spec:
      containers:
       - name: test-pod
         image: &lt;private-registry&gt;
      imagePullSecrets:
       - name: regcred
</code></pre>
