简体   繁体   中英

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

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.

Kubernetes is a runtime system for containers designed to support immutable deployment patterns. Containers are not patched in place, instead they are rebuilt and redeployed. To support this you need features that implement an ALM (Application Lifecycle Management) workflow with Kubenetes as it's target.

Take a look at the following products that add container build workflows on top of Kubernetes:

If you're a Java developer the following project can deploy a Jenkins based CD/CD pipeline for your code:

The Netflix project Spinnaker now supports Kubernetes as a deploy target for managed applications.

With the exception of Openshift (See minishift ) the above projects can be deployed as applications on top of minikube. Have fun!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM