debugyamlkubernetesMinor
error validating data: ValidationError(Deployment): unknown field "spec" in
Viewed 0 times
fielderrorunknownvalidationerrorvalidatingdatadeploymentspec
Problem
I know that
I got the above error running
yml files are temperamental and I still struggle to figure it out. Can anyone help out here to understand what is it about my client-deployment.yml file that makes Kubernetes want to issue the above error?apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment
spec:
replicas: 1
selector:
matchLabels:
component: web
template:
metadata:
labels:
component: web
spec:
containers:
- name: client
image: ldco2016/multi-client:v1.2
ports:
- containerPort: 3000I got the above error running
kubectl apply -f k8sk8s being one of the folders in the project with the yml configuration files.Solution
Sure enough, everything and including the last
Unfortunately, you can't tell the difference with how
spec: needed to be tabbed to the left once:apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment
spec:
replicas: 3
selector:
matchLabels:
component: web
template:
metadata:
labels:
component: web
spec:
containers:
- name: client
image: ldco2016/multi-client
ports:
- containerPort: 3000Unfortunately, you can't tell the difference with how
yaml is formatted when pasted here, so it would not have been an easy catch, but if you would be looking at the original file configuration you would have noticed it like I did when I looked a third time.Code Snippets
apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment
spec:
replicas: 3
selector:
matchLabels:
component: web
template:
metadata:
labels:
component: web
spec:
containers:
- name: client
image: ldco2016/multi-client
ports:
- containerPort: 3000Context
StackExchange DevOps Q#6694, answer score: 3
Revisions (0)
No revisions yet.