docker - Kubernetes Deployment file error: Found invalid field selector for v1.PodSpec -


i'm getting invalid field selector error when try , create deployment using yaml file. error error validating data: found invalid field selector v1.podspec , file can seen below.

apiversion: apps/v1beta1 kind: deployment metadata:  name: zalenium-deployment spec:  replicas: 1  template:   metadata:    labels:     app: zalenium   spec:    serviceaccountname: zalenium    serviceaccount: zalenium    selector:     app: zalenium     role: grid    containers:     - name: zalenium-pod       image: dosel/zalenium       ports:       - containerport: 4444         protocol: tcp       volumemounts:       - name: zalenium-shared         mountpath: /tmp/mounted       - name: zalenium-videos         mountpath: /home/seluser/videos       resources:        requests:         memory: "250m"         cpu: "500m"        limits:         memory: "1gi"    volumes:    - name: zalenium-shared      persistentvolumeclaim:       claimname: zalenium-shared-claim    - name: zalenium-videos      persistentvolumeclaim:       claimname: zalenium-videos-claim 

i have tried using online yaml file validator , don't seem show wrong format. when try , create deployment above validate=false flag, deployment runs, pods continuously crash , restart (crashloopbackoff). should looking into? i'm still getting familiar k8s error assume had container specs in deployment. tips on approaching this? thanks!

as error message states selector invalid field v1.podspec - field not valid @ .spec.template.spec.selector. think looking .spec.selector.

that being said, doc states:

if specified, .spec.selector must match .spec.template.metadata.labels, or rejected api.

so must add role: grid metadata labels (at .spec.template.metadata.labels). .yaml file sth then:

apiversion: apps/v1beta1 kind: deployment metadata:  name: zalenium-deployment spec:  selector:   matchlabels:    app: zalenium    role: grid  replicas: 1  template:   metadata:    labels:     app: zalenium     role: grid   spec:    serviceaccountname: zalenium    serviceaccount: zalenium    containers:     - name: zalenium-pod       image: dosel/zalenium       ports:       - containerport: 4444         protocol: tcp       volumemounts:       - name: zalenium-shared         mountpath: /tmp/mounted       - name: zalenium-videos         mountpath: /home/seluser/videos       resources:        requests:         memory: "250m"         cpu: "500m"        limits:         memory: "1gi"    volumes:    - name: zalenium-shared      persistentvolumeclaim:       claimname: zalenium-shared-claim    - name: zalenium-videos      persistentvolumeclaim:       claimname: zalenium-videos-claim 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -