Fix this YAML that fails with "mapping values are not allowed here".
BeginnerHands-onWrite-a-Kubernetes-manifest tasks
Answer
Broken:
containers:
- name: app
image: myapp:1.0
command: ["sh", "-c", "echo starting: now && ./run"]
env:
- name: GREETING
value: Hello: world
Fixed:
env:
- name: GREETING
value: "Hello: world"
Key trick → An unquoted : inside a plain scalar starts a new mapping. Quote values that contain : , #, or start with *, &, { or [. Also quote "yes", "no", "on" and numbers you want as strings.
More on Write-a-Kubernetes-manifest tasks
Write a Deployment and Service for an Nginx app with 3 replicas, resources and probes.BeginnerAdd an HPA that scales the Deployment between 3 and 15 pods at 70% CPU.BeginnerFix this broken Deployment YAML.BeginnerWrite a ConfigMap and Secret and inject them as environment variables and as a mounted file.IntermediateWrite an Ingress that routes `/api` to the api service and `/` to the web service with TLS.IntermediateWrite a pod spec with a hardened securityContext.Intermediate