Error saying Error error parsing app-deployment yaml error converting YAML to JSON

+2 votes

I'm getting an error when i try to create a pod

kubectl create -f app-deployment.yaml

Error: error parsing app-deployment.yaml: error converting YAML to JSON

my yaml file

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: app1
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: app1
    spec:
      containers:
      - name: app1
        image: dockersamples/static-site
        env:
        - name: AUTHOR
          value: app1
        ports:
        - containerPort: 80
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: app2
spec:
  replicas: 2
  template:
    metadata:
     labels:
        app: app2
   spec:
     containers:
      - name: app2
        image: dockersamples/static-site
        env:
        - name: AUTHOR
          value: app2
        ports:
        - containerPort: 80o

I have no idea what the issue is?

Sep 20, 2018 in Kubernetes by Hannah
• 18,520 points

edited Sep 20, 2018 by Hannah 10,283 views
Can you please update the question and add your app-deploymnet.yaml file!
This error usually occurs when there is a mistake in the yaml file most of the times tying mistake.

Paste your yaml into a yaml validator:

https://onlineyamltools.com/validate-yaml

YAMLException: bad indentation of a mapping entry at line 31, column 4:
       spec:
       ^

You can also use https://yamlonline.com/ for the yaml validator as well as yaml converter to json,csv,xml,base64 also for beautify and minify YAML.

Paste your yaml into a yaml validator:

https://yamlonline.com

you can also convert your YAML to json, xml, csv and base64 .

Hey @Pushpa Khatri, thanks for your contribution to the Edureka Community.

Kindly register yourself so that you can get points for every contribution( answer/question/upvote/downvote/ comment). Top contributors win exciting merchandise.

Cheers!

1 answer to this question.

0 votes
This error usually occurs when there's a mistake in your yaml file, either spelling or tying error.

And that's exactly whats happened in your case, Check the last line of your yaml file

 - containerPort: 80o

it should be

 - containerPort: 80
answered Sep 20, 2018 by Kalgi
• 52,350 points

Related Questions In Kubernetes

0 votes
1 answer
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,488 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,041 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP