How to work efficiently locally with Kubernetes/Docker?

4/18/2018

I am new with Docker and i just made my first test with Kubernetes locally (with Minikube), and it sounds promising! Now i would like to know how we are supposed to work with these tools efficiently when working on the code.

With docker, i wasn’t very satisfy about the process but it wasn’t so bad:

  1. I made a change in the code
  2. I stop the container
  3. I rebuild the image
  4. I run the image again

I guess there are ways/tools to avoid to executes all theses steps manually but i was thinking about diving further later.

But now i work with Kubernetes/Minikube, here is what the developing process looks like:

  1. I made a change in the code
  2. I delete the pod
  3. I rebuild the image
  4. I save it as a tar archive, then loads it in minikube

Executing all of these steps everytime we make a change in the code slow down significantly the productivity.

Is there a way to optimize/automatize this process for every time we make a change in the code?

-- Ludo
docker
kubernetes

1 Answer

4/18/2018

There's a bunch of third party tools our there to help with this such as Draft and gitkube.

I personally use draft, which creates a heroku like workflow which makes pushing new applications much easier.

Using Draft with minikube is fairly straightforward:

# enable some plugins
minikube addons enable registry
minikube addons enable ingress

# install helm
# depends on your workstation, I have a mac so:
brew install kubernetes-helm

# configure helm on your minikube
helm init

# install draft
brew tap azure/draft
brew install draft
draft init --auto-accept --ingress-enabled

# from your repo do:
draft create --app myapp
# run your app
draft up

More resources:

https://medium.com/@vittore/draft-on-k8s-part1-e5b046857df4

https://radu-matei.com/blog/real-world-draft/

-- jaxxstorm
Source: StackOverflow