# The Request is Invalid message - when running kubectl apply -f elasticsearch.yaml

**URL:** <https://discuss.elastic.co/t/the-request-is-invalid-message-when-running-kubectl-apply-f-elasticsearch-yaml/379235>\
**Category:** Elastic Training\
**Created:** [June 17, 2025, 9:38am UTC](https://discuss.elastic.co/t/the-request-is-invalid-message-when-running-kubectl-apply-f-elasticsearch-yaml/379235 "2025-06-17T09:38:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LilGems](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@LilGems](https://discuss.elastic.co/u/LilGems)\
**Post date:** [June 17, 2025, 9:38am UTC](https://discuss.elastic.co/t/the-request-is-invalid-message-when-running-kubectl-apply-f-elasticsearch-yaml/379235/1 "2025-06-17T09:38:19Z")

</div>

Course: Introduction to ECK  
Version: latest  
Question:

In Lab, Lesson 3  
Running the command to apply latest changes to elasticsearch .yaml  
I've copied and pasted the additional code from the example

This is the file:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/3/13b2782e6dbfcd4a7708e5e37fe5bcf1b31813eb.png)

The output: The request is Invalid: patch: invalid value ....  
Then at the end: Strict decoding error: unknown field "volumeClaimTemplates"

I can't get the formatting right. I am copying and pasting the code block but then have to manually reformat each line in vim . I can't get the hang of it.  
Everytime I run the kubectl apply command, there is a decoding error on different fields I fix one field but then there's another field error.  
Help!

---

<div class="post-metadata">

**Author:** ![LilGems](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@LilGems](https://discuss.elastic.co/u/LilGems)\
**Post date:** [June 17, 2025, 11:52am UTC](https://discuss.elastic.co/t/the-request-is-invalid-message-when-running-kubectl-apply-f-elasticsearch-yaml/379235/2 "2025-06-17T11:52:38Z")

</div>

Note: even when I copy the example code block in the lab and do a set: paste in vim, I still see a similar error.

---

<div class="post-metadata">

**Author:** ![joe\_d](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_d/32/45613_2.png) [@joe\_d](https://discuss.elastic.co/u/joe_d)\
**Post date:** [June 18, 2025, 3:51am UTC](https://discuss.elastic.co/t/the-request-is-invalid-message-when-running-kubectl-apply-f-elasticsearch-yaml/379235/3 "2025-06-18T03:51:10Z")

</div>

A few things jump out at first.

First, the `volumeClaimTemplates` block is indented at the highest level and should be inline with values like `count`, `config`, and so on under the `nodeSets` block.

Overall though, it looks like at least one example had some bad indentation so the entire lab is going be reviewed and corrected.

I have taken the example from the documentation (Lesson 3, Step 6) and wrapped it in a cat EOF wrapper that should let you copy this block and deploy it from the CLI only. See if this works, I tested it myself earlier...you can also paste the entire thing into a yaml file and trim the top and bottom lines if you think thats easier to iterate on.

Good luck and don't sleep on using `kubectl explain es.spec.etc.etc` to see fields and hierarchy explained. Great for checking which level things go and what they are.

```auto
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: main
spec:
  version: 8.17.0
  nodeSets:
  - name: new
    count: 1
    config:
      node.store.allow_mmap: false
      node.roles: ["master", "data", "ingest"]
      xpack.security.audit.enabled: false
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        storageClassName: standard
EOF

```

---

<div class="post-metadata">

**Author:** ![LilGems](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@LilGems](https://discuss.elastic.co/u/LilGems)\
**Post date:** [June 18, 2025, 9:39am UTC](https://discuss.elastic.co/t/the-request-is-invalid-message-when-running-kubectl-apply-f-elasticsearch-yaml/379235/4 "2025-06-18T09:39:42Z")

</div>

That helped enormously, I'm new to this so appreciate the tips. Yeah, I thought it was weird I was copying the example code block in the training and still getting it wrong. Thanks again.
