on line 20 during Deployment creation. looks good to me though.
apiVersion: apps/v1
kind: Deployment
metadata:
name: webserver
labels:
app: nginx
spec:
replicas: 3
selector:
matchlabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
Copying directly, I get this error:
error: error validating "test.yaml": error validating data:
ValidationError(Deployment.spec.selector): unknown field "matchlabels" in
io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector;
if you choose to ignore these errors, turn validation off with
--validate=false
you need to capitalize the L in the match labels selector:
matchlabels
-> matchLabels
After doing that it worked for me.
Yeah, I see that now. I wish it had said something about that instead of an indentation error.
Is that test.yaml file something you custom made ?
I copied and pasted the yaml you posted into a text file and called it test.yaml
You got a different error message than I did. did you pass the file to kubectl ?
Yup – all I did was: kubectl create -f test.yaml