Kubernetes Minikube hostPath安装未重新加载 [英] Kubernetes Minikube hostPath mount not reloading
问题描述
我有一个通过Minikube在本地运行的Kubernetes集群.
I have a Kubernetes cluster running locally via Minikube.
我在Mac上有一个本地文件夹,该文件夹通过hostPath卷配置安装,并且可通过以下位置的Docker容器访问:/code/bot
I have a local folder on my Mac mounted via the hostPath volume config and accessible to the Docker container at the location: /code/bot
我可以创建服务并加载网页.但是,当我更改代码并重新加载页面时,它不会更新.我必须删除并重新创建部署才能刷新代码.
I can create a service and load the webpage just fine. But when I change the code and reload the page, it does not update. I have to delete and re-create the deployment for the code to refresh.
有什么方法可以使挂载处于活动状态",因此它会自动刷新吗?
Is there any way to have mount be "live", so it refreshes automatically?
推荐答案
备注:(已编译)代码应作为容器的一部分.您没有遵循为此设计的容器设计,因此您应该预期会有副作用.
A remark: (compiled) Code should be part of the container. You are not following the container design laid out for this, so you should expect side effects.
曾经说过:更改代码后,您可能必须重新启动容器,因为容器显然不会重新加载代码.
Having said that: You might have to restart your container when you change your code since your code is clearly not reloaded by your container.
自动刷新挂载取决于您使用的应用程序.有些应用程序意识到文件系统中的文件已更改并会重新加载,而另一些应用程序则必须自己编写代码,以有效地回到我的重新启动注释.
Auto refreshing the mount depends on the application you use. Some applications realize a file-system has a changed file and will reload, in others you will have to code this yourself effectively going back to my restart remark.
这篇关于Kubernetes Minikube hostPath安装未重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!