Reputation: 63
I have following YAML I am creating two pods in one YAML file.
apiVersion: v1
kind: Pod
metadata:
name: test
labels:
app: test
spec:
containers:
- name: test
image: test:latest
command: ["sleep"]
args: ["infinity"]
kind: Pod
metadata:
name: testing1
labels:
app: testing1
spec:
containers:
- name: testing1
image: testing1:latest
command: ["sleep"]
args: ["infinity"]
I am retrieving the following error. I checked the code on lint too, but I am unable to solve it.
error parsing pipeline.YAML: error converting YAML to JSON: line 27 could not find expected ':;
Help is highly appreciated. Thanks
Upvotes: 0
Views: 1331
Reputation: 816
Try this:
apiVersion: v1
kind: Pod
metadata:
name: test
labels:
app: test
spec:
containers:
- name: test
image: test:latest
command: ["sleep"]
args: ["infinity"]
---
apiVersion: v1
kind: Pod
metadata:
name: testing1
labels:
app: testing1
spec:
containers:
- name: testing1
image: testing1:latest
command: ["sleep"]
args: ["infinity"]
There was an indentation error under containers section and you have to separate the pod definition by ---
and also you had to add the apiVersion.
Upvotes: 3