Kubernetes : Error in yaml file

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

apiVersion: v1

kind: Pod


name: nginx-pod



- 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

    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