How to create a local development environment for Kubernetes?

Wernight picture Wernight · Apr 20, 2015 · Viewed 28.2k times · Source

Kubernetes seems to be all about deploying containers to a cloud of clusters. What it doesn't seem to touch is development and staging environments (or such).

During development you want to be as close as possible to production environment with some important changes:

  • Deployed locally (or at least somewhere where you and only you can access)
  • Use latest source code on page refresh (supposing its a website; ideally page auto-refresh on local file save which can be done if you mount source code and use some stuff like Yeoman).

Similarly one may want a non-public environment to do continuous integration.

Does Kubernetes support such kind of development environment or is it something one has to build, hoping that during production it'll still work?

Answer

Robert Bailey picture Robert Bailey · Apr 21, 2015

Update (2016-07-15)

With the release of Kubernetes 1.3, Minikube is now the recommended way to run Kubernetes on your local machine for development.


You can run Kubernetes locally via Docker. Once you have a node running you can launch a pod that has a simple web server and mounts a volume from your host machine. When you hit the web server it will read from the volume and if you've changed the file on your local disk it can serve the latest version.