简体   繁体   中英

kubernetes volume hostPath

I want to use kubernetes as my default development environment for that I set up the cluster locally with docker as explained in the official doc . I push my example to a github repository

My set up steps after having a kubernetes cluster running were:

* cd cluster_config/app && docker build --tag=k8s_php_dev . && cd ../..
* kubectl -s http://127.0.0.1:8080 create -f cluster_config/app/app.rc.yml
* kubectl -s http://127.0.0.1:8080 create -f cluster_config/app/app.services.yml

My issues comes since I want to map a local directory as a volume inside my app pod so I can share dynamically the files in there between my local host and the pod, so i can develop, change the files; and dynamically update on the service.

I use aa volume with a hostPath. The pod, replication controller and service are created successfully but the pod do not share the directory not even have the file on the supposed on the mountPath.

What I'm doing wrong?

Thanks

The issue was on the volume definition, the hostPath.path property should hold the absolute address of the directory to mount.

Example:

hostPath:
  path: /home/bitgandtter/Documents/development/php/k8s_devel_env

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM