简体   繁体   中英

Kubernetes restarting pods

I have containerized node js app running on kubernetes which has volume mounted to host.

For development purpose when there is any change in the host volume dir / files the node app should restart.

In Dockerfile i have

CMD ["forever", "index.js"]

This will just start the app when container starts, but it is not restarting when the change occurs.

I have cross checked and made sure that changes are syncing properly from host volume to container

forever needs a flag to restart on file changes. Try with:

CMD ["forever", "-w", "index.js"]

I tend to use nodemon in development because it watches file changes by default and won't try to restart the app if it fails (only a file change triggers a start), forever will try to restart forever.

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