minikube - Issues mounting hostPath in kubernetes -


alright, i'm trying set local version of jenkins container in kubernetes' minikube , using this guide model.

the problem i'm having hostpath not seem mounting correctly.

when try mount host path without using "persistentvolumeclaim" code looks this:

deployment_jenkins.yaml

apiversion: extensions/v1beta1  kind: deployment metadata:   name: jenkins   namespace: jenkins spec:   replicas: 1   template:     metadata:       labels:         app: master     spec:       containers:       - name: master         image: jenkins:2.7.2         ports:         - containerport: 8080         - containerport: 50000         readinessprobe:           httpget:             path: /login             port: 8080           periodseconds: 10           timeoutseconds: 5           successthreshold: 2           failurethreshold: 5         env:         - name: jenkins_opts           valuefrom:             secretkeyref:               name: jenkins               key: options         volumemounts:         - mountpath: /var/jenkins_home           name: jenkins-home         resources:           limits:             cpu: 500m             memory: 1500mi           requests:             cpu: 500m             memory: 1500mi       volumes:       - name: jenkins-home       hostpath:         path: /data 

and error when run kubectl apply-f deployment_jenkins.yaml:

my-mac kubernetes $ kubectl apply -f deployment_jenkins.yaml error: error validating "deployment_jenkins.yaml": error validating data:  found invalid field hostpath v1.podspec; if choose ignore these  errors, turn validation off --validate=false 

and when try use claims, this:

persistent_volume_claim_jenkins.yaml

kind: persistentvolumeclaim apiversion: v1 metadata:   name: jenkins-home-claim spec:   accessmodes:     - readwriteonce   resources:     requests:       storage: 5gi   volumename: jenkins-home 

persistent_volume_jenkins.yaml

kind: persistentvolume apiversion: v1 metadata:   name: jenkins-home spec:   accessmodes:     - readwriteonce   capacity:     storage: 5gi   hostpath:     path: /data 

deployment_jenkins.yaml

apiversion: extensions/v1beta1  kind: deployment metadata:   name: jenkins   namespace: jenkins spec:   replicas: 1   template:     metadata:       labels:         app: master     spec:       containers:       - name: master         image: jenkins:2.7.2         ports:         - containerport: 8080         - containerport: 50000         readinessprobe:           httpget:             path: /login             port: 8080           periodseconds: 10           timeoutseconds: 5           successthreshold: 2           failurethreshold: 5         env:         - name: jenkins_opts           valuefrom:             secretkeyref:               name: jenkins               key: options         volumemounts:         - mountpath: /var/jenkins_home           name: jenkins-home         resources:           limits:             cpu: 500m             memory: 1500mi       requests:         cpu: 500m         memory: 1500mi       volumes:       - name: jenkins-home         persistentvolumeclaim:           claimname: jenkins-home-claim 

and run command:

my-mac kubernetes $ kubectl apply -f . deployment "jenkins" configured persistentvolumeclaim "jenkins-home-claim" configured persistentvolume "jenkins-home" configured 

and ultimately, pod never spins , these errors in dashboard: enter image description here

i'm super confused , in figuring out i'm doing wrong , how work appreciated.

some of yaml mis-indented leading different (broken) interpretation:

volumes: - name: jenkins-home hostpath: path: /data

this object 2 fields, volumes , hostpath. want, instead, is:

volumes: - name: jenkins-home hostpath: path: /data

also, recommend quoting (non-block) strings in yaml avoid surprises:

volumes: - name: 'jenkins-home' hostpath: path: '/data'


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -