# Getting indentation error

**URL:** <https://discuss.kubernetes.io/t/getting-indentation-error/12117>\
**Category:** General Discussions\
**Created:** [August 3, 2020, 12:42am UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117 "2020-08-03T00:42:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulGureghian](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/paulgureghian/32/2752_2.png) [@PaulGureghian](https://discuss.kubernetes.io/u/PaulGureghian)\
**Post date:** [August 3, 2020, 12:42am UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117/1 "2020-08-03T00:42:15Z")

</div>

on line 20 during Deployment creation. looks good to me though.

```auto
apiVersion: apps/v1
kind: Deployment
metadata:
  name: webserver
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchlabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:alpine
        ports:
        - containerPort: 80

```

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [August 3, 2020, 1:15am UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117/2 "2020-08-03T01:15:00Z")

</div>

Copying directly, I get this error:

```auto
error: error validating "test.yaml": error validating data: 
ValidationError(Deployment.spec.selector): unknown field "matchlabels" in
io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector;
if you choose to ignore these errors, turn validation off with
--validate=false

```

you need to capitalize the L in the match labels selector:

`matchlabels` -\> `matchLabels`

After doing that it worked for me.

---

<div class="post-metadata">

**Author:** ![PaulGureghian](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/paulgureghian/32/2752_2.png) [@PaulGureghian](https://discuss.kubernetes.io/u/PaulGureghian)\
**Post date:** [August 3, 2020, 1:51am UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117/3 "2020-08-03T01:51:45Z")

</div>

Yeah, I see that now. I wish it had said something about that instead of an indentation error.  
Is that test.yaml file something you custom made ?

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [August 3, 2020, 1:54am UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117/4 "2020-08-03T01:54:44Z")

</div>

I copied and pasted the yaml you posted into a text file and called it `test.yaml` 👍

---

<div class="post-metadata">

**Author:** ![PaulGureghian](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/paulgureghian/32/2752_2.png) [@PaulGureghian](https://discuss.kubernetes.io/u/PaulGureghian)\
**Post date:** [August 3, 2020, 3:48pm UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117/5 "2020-08-03T15:48:27Z")

</div>

You got a different error message than I did. did you pass the file to kubectl ?

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [August 3, 2020, 3:51pm UTC](https://discuss.kubernetes.io/t/getting-indentation-error/12117/6 "2020-08-03T15:51:42Z")

</div>

Yup – all I did was: `kubectl create -f test.yaml`
