GoogleCloudPlatform/freshpod

Name: freshpod

Owner: Google Cloud Platform

Description: Restart Pods on Minikube automatically on image rebuilds

Created: 2017-12-16 06:09:00.0

Updated: 2018-05-20 00:41:06.0

Pushed: 2018-03-20 22:46:24.0

Homepage:

Size: 3900

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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.

:new: 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:

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

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

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

ctl expose deploy/hello --type=NodePort

Visit the app (note the 1.0.0):

L=$(minikube service hello --url)
rl "$URL"
o, world!
ion: 1.0.0
name: hello-5766f88f9c-67lgz

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

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

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

rl "$URL"
o, world!
ion: 2.0.0
name: hello-5766f88f9c-h88df

Contributing

See CONTRIBUTING.md for more information.

This is not an official Google product.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.