Unable to create POD in kubernetes1 Getting error

6/8/2020

I am learning Kubernetes and creating a Pod with configmap. I created a yaml file to create a POD. But I am getting below error

error: error parsing yuvi.yaml: error converting YAML to JSON: YAML: line 13: mapping values are not allowed in this context

My configmap name: yuviconfigmap

YAML file:


apiVersion: v1
kind: Pod
metadata:
 name: yuvipod1
spec:
 containers:
   - name: yuvicontain
     image: nginx
     volumeMounts:
     - name: yuvivolume
        mountPath: /etc/voulme
  volumes:
  - name: yuvivolume
    configMap:
      name: yuviconfigmap
-- Yuva Raj
kubernetes

1 Answer

6/8/2020

The yaml is not as per what kubernetes expects. Below should work.

apiVersion: v1
kind: Pod
metadata:
  name: yuvipod1
spec:
  containers:
  - name: yuvicontain
    image: nginx
    volumeMounts:
    - name: yuvivolume
      mountPath: /etc/voulme
  volumes:
    - name: yuvivolume
      configMap:
        name: yuviconfigmap
-- Arghya Sadhu
Source: StackOverflow