<p>I am new to DevOps. I wrote a deployment.yaml file for a Kubernetes cluster I just created on AWS. Creating the deployment keeps bringing up errors that I can't decode for now. This is just a test deployment in preparation for the migration of my company's web apps to kubernetes.</p>
<p>I tried editing the content of the deployment to look like conventional examples I've found. I can't even get this simple example to work. You may find the deployment.yaml content below.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ghost
  labels:
    app: ghost
spec:
  ports:
  - port: 80
  selector:
    app: ghost
    tier: frontend
  type: LoadBalancer
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: ghost
  labels:
    app: ghost
spec:
  selector:
    matchLabels:
      app: ghost
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: ghost
        tier: frontend
    spec:
      containers:
      - image: ghost:4-alpine
        name: ghost
        env:
        - name: database_client
          valueFrom:
            secretKeyRef:
              name: eks-keys
              key: client
        - name: database_connection_host
          valueFrom:
            secretKeyRef:
              name: eks-keys
              key: host
        - name: database_connection_user
          valueFrom:
            secretKeyRef:tha
        - name: database_connection_password
          valueFrom:
            secretKeyRef:
              name: eks-keys
              key:  ghostdcp
        - name: database_connection_database
          valueFrom:
            secretKeyRef:
              name: eks-keys
              key: ghostdcd
        ports:
        - containerPort: 2368
          name: ghost
        volumeMounts:
        - name: ghost-persistent-storage
          mountPath: /var/lib/ghost
      volumes:
      - name: ghost-persistent-storage
        persistentVolumeClaim:
          claimName: efs-ghost
</code></pre>
<p>I ran this line on cmd in the folder container:</p>
<p><code>kubectl create -f deployment-ghost.yaml --validate=false</code></p>
<blockquote>
<p>service/ghost created
Error from server (BadRequest): error when creating &quot;deployment-ghost.yaml&quot;: Deployment in version &quot;v1&quot; cannot be handled as a Deployment: v1.Deployment.Spec: v1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec: v1.PodSpec.Containers: []v1.Container: v1.Container.Env: []v1.EnvVar: v1.EnvVar.ValueFrom: readObjectStart: expect { or n, but found &quot;, error found in #10 byte of ...|lueFrom&quot;:&quot;secretKeyR|..., bigger context ...|},{&quot;name&quot;:&quot;database_connection_user&quot;,&quot;valueFrom&quot;:&quot;secretKeyRef:tha&quot;},{&quot;name&quot;:&quot;database_connection_pa|...</p>
</blockquote>
<p>I couldn't even get any information on this from my search. I can't just get the deployment created. Pls, who understands and can put me through?</p>

Vahid
<blockquote>
<p>{&quot;name&quot;:&quot;database_connection_user&quot;,&quot;valueFrom&quot;:&quot;secretKeyRef:tha&quot;},</p>
</blockquote>
<p>Your spec has error:</p>
<pre><code>...
- name: database_connection_user  # &lt;-- The error message points to this env variable
  valueFrom:
    secretKeyRef:
      name: &lt;secret name, eg. eks-keys&gt;
      key: &lt;key in the secret&gt;
...
</code></pre>
