使用freshpod實現Kubernetes容器的快速迭代

If you are using Minikube or Docker for Mac/Windows to run your Kubernetes deployments locally, I have developed a tool to restart containers automatically when their images are rebuilt: Check out freshpod on GitHub!node

Normally, when you do a docker build to build a new image, you have to manually restart Pods running on your Kubernetes node to use the new image. freshpod detects you rebuilt an image and restarts the Kubernetes Pods that are running that image:git

freshpod workflow

Here’s a demo of live refactoring an application and have it restart automatically on Minikube:github

 

freshpod on Minikube

freshpod is already in Minikube as an add-on thanks to a user who found about it before I even told anyone:docker

$ minikube addons enable freshpod

freshpod on 「Docker for Mac/Windows」

Since Docker for Mac/Windows now offers local Kubernetes support, it is very much like Minikube. You can take the manifest file used by Minikube and apply it directly to Kubernetes on Docker:app

kubectl apply -f https://github.com/kubernetes/minikube/raw/master/deploy/addons/freshpod/freshpod-rc.yaml

DIY: Rebuild containers when files change

You can use entr(1) to run a command when files on your computer change.ide

This command will build a new image when any of the *.py files in the current directory changes:ui

$ find . -name '*.py' | entr docker build -t myapp .

On top of this, if you have freshpod installed, you can automatically have local Kubernetes Pods restart automatically when the source code changes!this

freshpod is a small project that does one simple task. If you have any big ideas for it, let’s discuss!idea

相關文章
相關標籤/搜索