DEV Community

Cover image for Local stack for kubernetes
Antoine
Antoine

Posted on • Updated on

Local stack for kubernetes

Photo by Geran de Klerk on Unsplash

I am considering using one kubernetes i our stack. But the thing that stops me is the complexity of maintaining the cluster alive in the Cloud or locally in sync across the team.

It seems 2 tools can help me providing this:

  • Kind, by providing a local kubernetes cluster easy to setup
  • tilt, by providing a way to transition from docker-compose, and ease of development / debug of kubernetes.

Kind

By following the quickstart, i was able to start a cluster with a control plane and a node using the following file

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker

If you have an error saying that yaml cannot be merged, it means that your config file in your C:\Users\My_User.kube has some invalid character. You can delete it, if you can remove the existing context.

Then, a

kind create cluster --config=kind.config.yaml

brings me my cluster.

Tilt

I had followed the example, that you can find on github.

The only issue for me was that the port 8000 was blocked so i had to change all references in tiltfile, kubernetes.yaml, and sh to 8001.

Do not forget to kill your cluster as it can eat all your memory.

kind delete cluster

Update: Daniel Neumann write a good blog about setuping KinD locally

Hope this helps !

Top comments (3)

Collapse
 
habereder profile image
Raphael Habereder

Other cool tools I like to recommend are k3d, if you have to rely on docker, or k3s for kubernetes without the docker part.
If VMs are more your thing, there is k3os. And yes, I kind of love the rancher tooling :D

If you need more, I got a heavily scripted local setup via k3d as well, I could drop you a link to. It handles all the provisioning and brings some devops stuff with it for quick setup/teardown of a local stack.

Collapse
 
antoinega profile image
Antoine

I like Rancher too. If i could spare more time, i would love to have a look at k3s.
I'm trying to run away from scripts (due to maintenance), and keep things as simple as possible.

Thanks for the offer!

Collapse
 
j4ng5y profile image
Jordan Gregory

For quick sanity checks, I absolutely recommend Kind, but in the event that you are REALLY using kubernetes, nothing beats a real development cluster running on similar hardware as production.