Reputation: 400
I hope you are doing well
Please, I can't create this Deployment
I don't either know why or what can be the error.
It seems like some people have already had this error but I don't understand from the comment how they solve it.
I check into the Kubernetes documentation but nothing found.
apiVersion: apps/v1
kind: Deployment
metadata:
name: analysis-api
labels:
tier: msvc
name: analysis-api
component: backend
spec:
replicas: 1
selector:
matchLabels:
labels:
tier: msvc
name: analysis-api
component: backend
template:
metadata:
labels:
tier: msvc
name: analysis-api
component: backend
spec:
containers:
- name: main
image: guitou-app/msvc-analysis-api
env:
- name: ENV
value: dev
- name: MONGODB_URI
valueFrom:
configMapKeyRef:
name: env-vars
key: MONGODB_URI
- name: MONGODB_DBNAME
value: guitou-analysis
I've got this error
error: error validating "infra/k8s/analysis-api.yaml": error validating data: ValidationError(Deployment.spec.selector.matchLabels.labels): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.matchLabels: got "map", expected "string"; if you choose to ignore these errors, turn validation off with --validate=false
but I don't know what it means. metadata.labels, spec.template.labels and spec.selector.matchLabels are all identical.
Where should I start to find the solution?
Upvotes: 3
Views: 4340
Reputation: 30208
it should be something like
selector:
matchLabels:
tier: msvc
name: analysis-api
component: backend
instead
selector:
matchLabels:
labels:
tier: msvc
name: analysis-api
component: backend
Upvotes: 3