Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Development workflow on Minikube and docker

I am trying to understand how development is done efficiently with dockerized applications, specifically on Kubernetes. I am struggling to find the proper way to go about live editing containers.

In the past with Docker, I would just use something like Nodemon to watch for files to change locally and then when I had the app finished, I would dockerize it and deploy. With Kubernetes (minikube) my first impression is that I'm supposed to rebuild the container with each edit. Surely this cannot be the way people develop on here - what am I missing? Am I supposed to edit locally and then dockerize->k8s deploy? That doesnt seem right.

I am looking for a way to sync all my local changes to a docker container which then reboots the kubernetes pod with the new changes, so I can read from the logs during development. If this is odd, please recommend me a superior way.

Thanks

like image 900
dallinn Avatar asked Apr 03 '17 17:04

dallinn


People also ask

How does minikube work with Docker?

The kubecluster running inside the minikube vm actually uses Docker to run all the containers. So when you create kubernetes objects, e.g. pods, then you can use the docker cli to view the underlying containers that have been created.

Is Docker required for minikube?

Does Minikube require Docker? A Docker daemon is included with Minikube, so you don't need to install it separately.

Can you run minikube in a container?

You can run minikube in docker in docker container. It will use docker driver.

Can minikube be used for production?

minikube's primary goal is to quickly set up local Kubernetes clusters, and therefore we strongly discourage using minikube in production or for listening to remote traffic. By design, minikube is meant to only listen on the local network. However, it is possible to configure minikube to listen on a remote network.


1 Answers

Kubernetes is a container orchestration tool. It's not a development platform. It's designed to ease the deployment of hundreds of containers, and deal with lifecycle/networking/storage issues.

If you're developing your application, you really don't need kubernetes/minikube at the moment. My suggested workflow would be:

  • Develop your application in a local docker container. Iterate as you go until you're happy.
  • Create a snapshot release, tag the docker image and push it to a repo
  • Then deploy it.
  • When you need to update, apply a new tag.

The benefit of using Docker is that it will deploy exactly the same on your local laptop, as well as to a production k8s cluster, so once you've arrived at the stage where you're ready to tag/push images, you can be assured the deployment process will be exactly the same.

Minikube isn't for local development, it's for people to test out kubernetes locally, and possibly develop kubernetes itself, it's not designed as a vagrant alternative.

like image 133
jaxxstorm Avatar answered Sep 21 '22 15:09

jaxxstorm