error: error parsing pod_pvc.yml: error converting YAML to JSON: yaml: line 11: could not find expected ':'

0 votes

Hi Guys,

I am new in kubernetes. I am trying to create one pod. But it shows me the below error.

apiVersion: v1
kind: Pod
metadata:
  name: httpd
  labels:
    name: httpd
spec:
  containers:
  - name: httpd-con
    image=apache-webser-php
    volumeMounts:
    - name: pvc-vol
      mountPath: /var/www/html
  volumes:
  - name: pvc-vol
    persistentVolumeClaim:
      claimName: pvc-volume
$ kubectl apply -f pod_pvc.yml
error: error parsing pod_pvc.yml: error converting YAML to JSON: yaml: line 11: could not find expected ':'
May 22 in Kubernetes by akhtar
• 11,250 points
41 views

1 answer to this question.

0 votes

Hi@akhtar,

In yml code, you can't use equals to sign. To assign key value pair you can use colon. In above code you have written  image=apache-webser-php. Here you have to use colon instead of equals to.

apiVersion: v1
kind: Pod
metadata:
  name: httpd
  labels:
    name: httpd
spec:
  containers:
  - name: httpd-con
    image: apache-webser-php
    volumeMounts:
    - name: pvc-vol
      mountPath: /var/www/html
  volumes:
  - name: pvc-vol
    persistentVolumeClaim:
      claimName: pvc-volume
answered May 22 by MD
• 24,500 points

Related Questions In Kubernetes

+2 votes
1 answer

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

This error usually occurs when there's a ...READ MORE

answered Sep 20, 2018 in Kubernetes by Kalgi
• 51,850 points
2,133 views
0 votes
2 answers

Error saying “Error from server (NotFound): the server could not find the requested resource”

official Documentation says: A client should be skewed ...READ MORE

answered Sep 19, 2018 in Kubernetes by Nilesh
• 6,960 points
2,042 views
0 votes
1 answer

Could not find default credentials

Use gcloud auth application-default login to login for application ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 51,850 points
593 views
0 votes
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
6,640 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 11, 2019 in Kubernetes by Kalgi
• 51,850 points

reshown Apr 12, 2019 by Kalgi 1,972 views
0 votes
1 answer