it's my code there is an error in it?
apiVersion: V1
kind: Deployment
metadata:
name: platforms-dypl
spec:
replicas: 1
selector:
matchLabels:
app: platformservice
template:
metadata:
labels:
app: platformservice
spec:
containers:
- name: platformservice
image: mohamedfouadmohamed/platformservice
CodePudding user response:
You have a bad indentation before the second spec
(line 15).
This works fine:
apiVersion: V1
kind: Deployment
metadata:
name: platforms-dypl
spec:
replicas: 1
selector:
matchLabels:
app: platformservice
template:
metadata:
labels:
app: platformservice
spec:
containers:
- name: platformservice
image: mohamedfouadmohamed/platformservice
You can use a python linter for your yaml project to avoid this syntax problem, for example yamllint.
CodePudding user response:
There are two errors :
- apiVersion of deployment
- indentation of
spec:
Correct yaml file should be :
apiVersion: apps/v1 # it should be apps/v1 not V1
kind: Deployment
metadata:
name: platforms-dypl
spec:
replicas: 1
selector:
matchLabels:
app: platformservice
template:
metadata:
labels:
app: platformservice
spec: # corrected indentation
containers:
- name: platformservice
image: mohamedfouadmohamed/platformservice