Home > Software design >  Incorrect k8s deployment file
Incorrect k8s deployment file

Time:10-21

I am following Cloud Guru K8S course and have issues with the template they provided. I can't see what’s wrong.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: blue-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: bluegreen-test
      color: blue
  template:
    metadata:
      labels:
        app: bluegreen-test
        color: blue
    spec:
      containers:
      - name: nginx
        image: linuxacademycontent/ckad-nginx:blue
        ports:
        - containerPort: 80

When I run

kubectl apply -f my-deployment.yml

I get

error: error parsing blue-deployment.yml: error converting YAML to JSON: yaml: line 4: found character that cannot start any token

What's wrong with this template? It's nearly identical to the official example deployment definition enter image description here

You can validate the syntax at the below link as well

https://validkube.com/

  • Related