简体   繁体   English

kubernetes卷hostPath

[英]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 . 我想使用kubernetes作为我的默认开发环境,我使用docker在本地设置集群,如官方文档中所述 I push my example to a github repository 我将我的示例推送到github存储库

My set up steps after having a kubernetes cluster running were: 运行kubernetes集群后,我的设置步骤如下:

* 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; 我的问题出现了,因为我想将本地目录映射为我的应用程序窗格内的卷,这样我就可以动态共享我本地主机和pod之间的文件,这样我就可以开发,更改文件; and dynamically update on the service. 并动态更新服务。

I use aa volume with a hostPath. 我使用了一个带有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. pod,复制控制器和服务已成功创建,但pod不共享目录,甚至没有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. 问题出在卷定义上,hostPath.path属性应该包含要挂载的目录的绝对地址。

Example: 例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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