[英]Skaffold update files but the app still use the start Dcoker image
I'm having a local cluster using K3d , inside it, there is an API developed in Lumen (Laravel).我有一个使用K3d的本地集群,在它里面,有一个在 Lumen (Laravel) 中开发的 API。
I'm also having Skaffold to work and test my application inside my local cluster.我还让Skaffold在我的本地集群中工作和测试我的应用程序。 I'm running Skaffold in dev mode, that will allow me to hot load my files in case of changes.
我在开发模式下运行 Skaffold,这将允许我在发生更改时热加载我的文件。
In my case the files did change inside the container but the app still act as the first pod creation.在我的例子中,容器内的文件确实发生了变化,但应用程序仍然充当第一个 pod 创建。 So I can change file any time the app still have the same state always.
所以我可以随时更改文件,应用程序仍然始终具有相同的 state。
Here is my Skaffold deploy config这是我的 Skaffold 部署配置
apiVersion: skaffold/v2beta29
kind: Config
metadata:
name: api
build:
tagPolicy:
sha256: {}
artifacts:
- image: api
docker:
dockerfile: Dockerfile
sync:
manual:
- src: '**/*'
dest: '/var/www/html'
deploy:
kustomize:
paths:
- k8s\dev
profiles:
- name: base
deploy:
kustomize:
paths:
- k8s\base
Skaffold's sync only transfers your files: you need to ensure your app or server then uses those changed files. Skaffold 的同步仅传输您的文件:您需要确保您的应用程序或服务器随后使用那些更改的文件。
Some web frameworks are able detect and reload source changes (may require running in a debug mode).一些 web 框架能够检测并重新加载源更改(可能需要在调试模式下运行)。 Other approaches are to use separate tools to monitor for filesystem changes and relaunch the application;
其他方法是使用单独的工具来监视文件系统更改并重新启动应用程序;
nodemon
and watchexec
are some typical examples. nodemon
和watchexec
是一些典型的例子。
If you're syncing data files, you need to ensure that your code reloads file content, and doesn't continue using stale data.如果您正在同步数据文件,则需要确保您的代码重新加载文件内容,并且不会继续使用过时的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.