mohit sharma
mohit sharma

Reputation: 640

kubernetes development environment to reduce development time

I'm new to devops and kubernetes and was setting up the local development environment. For having hurdle-free deployment, I wanted to keep the development environment as similar as possible to the deployment environment. So, for that, I'm using minikube for single node cluster, and that solves a lot of my problems but right now, according to my knowledge, a developer need to do following to see the changes:

  1. write a code locally,
  2. create a container image and then push it to container register
  3. apply the kubernetes configuration with updated container image

But the major issue with this approach is the high development time, Can you suggest some better approach by which I can see the changes in real-time?

Upvotes: 6

Views: 896

Answers (5)

Paul Z.
Paul Z.

Reputation: 905

It's not been so long for me to get involved in Kubernetes and Docker, but to my knowledge, I think it's the first step to learn whether it is possible and how to dockerize your application.

Kubernetes is not a tool for creating docker image and it is simply pulling pre-built image by Docker.

There are quite a few useful courses in the Udemy including this one. https://www.udemy.com/docker-and-kubernetes-the-complete-guide/

Upvotes: -1

Lukas Gentele
Lukas Gentele

Reputation: 969

The official Kubernetes blog lists a couple of CI/CD dev tools for building Kubernetes based applications: https://kubernetes.io/blog/2018/05/01/developing-on-kubernetes/

However, as others have mentioned, dev cycles can become a lot slower with CI/CD approaches for development. Therefore, a colleague and I started the DevSpace CLI. It lets you create a DevSpace inside Kubernetes which allows you a direct terminal access and real-time file synchronization. That means you can use it with any IDE and even use hot reloading tools such as nodemon for nodejs.

DevSpace CLI on GitHub: https://github.com/covexo/devspace

Upvotes: 2

James Strachan
James Strachan

Reputation: 9198

On the Jenkins X project we're big fans of using DevPods for fast development - which basically mean you compile/test/run your code inside a pod inside the exact same kubernetes cluster as your CI/CD runs using the exact same tools (maven, git, kubectl, helm etc).

This lets you use your desktop IDE of your choice while all your developers get to work using the exact same operating system, containers and images for development tools.

I do like minikube but developers often hit issues trying to get it running (usually related to docker or virtualisation issues). Plus many developers laptops are not big enough to run lots of services inside minikube and its always going to behave differently to your real cluster - plus then the developers tools and operating system are often very different to whats running in your CI/CD and cluster.

Here's a demo of how to automate your CI/CD on Kubernetes with live development with DevPods to show how it all works

Upvotes: 0

slintes
slintes

Reputation: 770

I think using Docker / Kubernetes already during development of a component is the wrong approach, exactly because of this slow development cycles. I would just develop as I'm used to do (e.g. running the component in the IDE, or a local app server), and only build images and start testing it in a production like environment once I have something ready to deploy. I only use local Docker containers, or our Kubernetes development environment, for running components on which the currently developed component depends: that might be a database, or other microservices, or whatever.

Upvotes: 1

Javier Salmeron
Javier Salmeron

Reputation: 8825

I am afraid that the first two steps are practically mandatory if you want to have a proper CI/CD environment in Kubernetes. Because of the ephemeral nature of containers, it is strongly discouraged to perform hotfixes in containers, as they could disappear at any moment.

There are tools like helm or kubecfg that can help you with the third step

apply the kubernetes configuration with updated container image

They allow versioning and deployment upgrades. You would still need to learn how to use but they have innumerable advantages.

Another option that comes to mind (that without Kubernetes) would be to use development containers with Docker. In this kind of containers your code is in a volume, so it is easier to test changes. In the worst case you would only have to restart the container.

Examples of development containers (by Bitnami) (https://bitnami.com/containers):

Upvotes: 1

Related Questions