Kubernetes version: minikube version: v0.28.2
Host OS: Ubuntu 16.04 server
the document states, "“A
hostPath volume mounts a file or directory from the host node’s filesystem into your Pod.”
I created my minikube cluster in my Ubuntu16.04 server, the ‘node’ is thus a virtualbox VM. Should hostpath be a path in the VM, or the real path on the Ubuntu host? In the YAML file below, the /home/user1/data/mq and /home/user1/log/mq are two directories on the Ubuntu server that I want to mount to two directories in the container in the Pod. Although the pod and container are running, the mount didn’t happen. Should I first mount the path to the VM and then mount further into the container in the pod?
Can anyone share a success experience how it should be done?
labels: # labels are always contained inside metadata section.
| app: mq
spec: # ‘spec’ specifies what (pods) are to be deployed and in what fassion
replicas: 1 # one instances
selector: # selectors are contained in the spec. a selector in deployment
| | | | | # deployment manages pods
| | app: mq
template: # ‘template’ holds the blueprint of a pod, i.e. the configuration
| | | | | # of the pods which deployment manages
| metadata: # metadata of the pod
| | labels: # labels of the pods the containing deployment manages
| | | app: mq
| spec: # attributes of spec are specific to the ‘kind’.
| | | | | # different ‘kind’ requires different spec.
| | containers: # the kind of ‘Deployment’ decides spec of ‘Containers’
| | - name: mq # pod created from container ‘mq’
| | | image: 192.168.99.100:80/qm1414:1.1 # from container image
| | | volumeMounts:
| | | - mountPath: /var/mqm/data
| | | | name: mqdata
| | | - mountPath: /var/mqm/log
| | | | name: mqlog
| | | ports:
| | | - containerPort: 1414 # the port mq listens to in the container.
| | volumes:
| | - name: mqdata
| | | hostPath:
| | | | path: /home/user1/data/mq
| | - name: mqlog
| | | hostPath:
| | | | path: /home/user1/log/mq