GithubHelp home page GithubHelp logo

isabella232 / freshpod Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/freshpod

0.0 0.0 0.0 3.81 MB

Restart Pods on Minikube automatically on image rebuilds

License: Apache License 2.0

Go 100.00%

freshpod's Introduction

freshpod

freshpod helps you automatically restart containers on Kubernetes when their image is updated.

It is designed for single-instance Kubernetes clusters, such as Minikube or Docker for Windows/Mac.

freshpod detects you rebuilt an image and it deletes the Kubernetes Pods are running that image. This way, your workload controller (such as Deployment) will create new Pods running the new image.

🆕 Check out Skaffold, a new tool by Google that simplifies local Kubernetes development experience. Skaffold supersedes freshpod.

Demo

This demo shows refactoring an application and running docker build will automatically restart the application with the new image on Minikube:

A command line demo of freshpod replacing pods when the image is updated

Install on Minikube

freshpod is available as an add-on for Minikube. You just need to enable it:

minikube addons enable freshpod

Install on “Docker for Mac/Windows”

If you’re using Kubernertes on Docker for Mac/Windows, you can directly apply the manifest used by Minikube:

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

Try it out!

Get some test images and tag the :1.0 image as hello:latest:

eval $(minikube docker-env) # not necessary for docker-for-mac/windows
docker pull gcr.io/google-samples/hello-app:1.0
docker pull gcr.io/google-samples/hello-app:2.0
docker tag  gcr.io/google-samples/hello-app:1.0 hello:latest

Run a 2-replica Deployment and NodePort Service with hello:latest image:

kubectl run hello --image=hello --port 8080 --replicas=2 \
  --image-pull-policy=IfNotPresent

kubectl expose deploy/hello --type=NodePort

Visit the app (note the 1.0.0):

$ URL=$(minikube service hello --url)
$ curl "$URL"
Hello, world!
Version: 1.0.0
Hostname: hello-5766f88f9c-67lgz

Re-tag the hello:latest image with the 2.0 version:

docker tag gcr.io/google-samples/hello-app:2.0 hello

Visit the app again (note the version has changed to 2.0.0):

$ curl "$URL"
Hello, world!
Version: 2.0.0
Hostname: hello-5766f88f9c-h88df

Contributing

See CONTRIBUTING.md for more information.

This is not an official Google product.

freshpod's People

Contributors

ahmetb avatar blackstar257 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.