<p>I hope you are doing well</p>
<p>Please, I can't create this <strong>Deployment</strong></p>
<p>I don't either know why or what can be the error.</p>
<p>It seems like some people have already had this error but I don't understand from the comment how they solve it.</p>
<p>I check into the Kubernetes documentation but nothing found.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: analysis-api
  labels:
    tier: msvc
    name: analysis-api
    component: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      labels:
        tier: msvc
        name: analysis-api
        component: backend
  template:
    metadata:
      labels:
        tier: msvc
        name: analysis-api
        component: backend
    spec:
      containers:
      - name: main
        image: guitou-app/msvc-analysis-api
        env:
        - name: ENV
          value: dev
        - name: MONGODB_URI
          valueFrom:
            configMapKeyRef:
              name: env-vars
              key: MONGODB_URI
        - name: MONGODB_DBNAME
          value: guitou-analysis
</code></pre>
<p>I've got this error</p>
<pre><code>error: error validating &quot;infra/k8s/analysis-api.yaml&quot;: error validating data: ValidationError(Deployment.spec.selector.matchLabels.labels): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.matchLabels: got &quot;map&quot;, expected &quot;string&quot;; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p>but I don't know what it means.
<strong>metadata.labels</strong>, <strong>spec.template.labels</strong> and <strong>spec.selector.matchLabels</strong> are all identical.</p>
<p>Where should I start to find the solution?</p>

Mael Fosso
<p>it should be something like</p>
<pre><code>selector:
    matchLabels:
      tier: msvc
      name: analysis-api
      component: backend
</code></pre>
<p>instead</p>
<pre><code>selector:
    matchLabels:
      labels:
        tier: msvc
        name: analysis-api
        component: backend
</code></pre>
