Kubernetes : Error in yaml file

I am going through the CKA and following exercise to deploy a pod :

apiVersion: v1

kind: Pod

metadata:

name: nginx-pod

spec:

containers:

- name: nginx

image: nginx

restartPolicy: Always

and getting this error :

kubectl create -f nginx.yaml

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


Please help.


  • post-author-pic
    Thulasiraman V
    01-07-2019

    This error happens due to some blank space added or instead of using the spacebar u might used the tab for the indentation. Just try to remove it. It should work.

Looking For Team Training?

Learn More