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,570 points

edited Sep 20, 2018 by Hannah 9,699 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,360 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
14,523 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 5,977 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