|
1 | 1 | # minikube-local
|
| 2 | + |
2 | 3 | The best way to set minikube up for local development
|
| 4 | + |
| 5 | +[](https://circleci.com/gh/tilt-dev/minikube-local) |
| 6 | + |
| 7 | +When using Tilt with a [Minikube](https://minikube.sigs.k8s.io/docs/) cluster, |
| 8 | +we recommend using a local registry for faster image pushing and pulling. |
| 9 | + |
| 10 | +This repo documents the best way to set it up. |
| 11 | + |
| 12 | +## Why use Minikube with a local registry? |
| 13 | + |
| 14 | +Minikube offers many different ways to get your app into the cluster. |
| 15 | + |
| 16 | +Using a local registry is the best method for iterative app development. |
| 17 | + |
| 18 | +- Unlike with a remote registry, the image stays local to your machine, with no |
| 19 | + network traffic to wait on or credentials to setup. |
| 20 | + |
| 21 | +- Unlike with an in-cluster builder, you can reset the cluster without deleting |
| 22 | + the image cache. |
| 23 | + |
| 24 | +- Unlike with loading into the container runtime, docker will skip pushing any |
| 25 | + layers that already exist in the registry. |
| 26 | + |
| 27 | +Over all these approaches, a local registry has good speed, incremental caching, |
| 28 | +and few footguns. But setting it up is awkward and fiddly. This script makes it |
| 29 | +easy. |
| 30 | + |
| 31 | +## How to Try It |
| 32 | + |
| 33 | +1) Install [Minikube](https://minikube.sigs.k8s.io/docs/) |
| 34 | + |
| 35 | +2) Copy the [minikube-with-registry.sh](minikube-with-registry.sh) script somewhere on your path. |
| 36 | + |
| 37 | +3) Create a cluster with `minikube-with-registry.sh`. Currently it creates the registry at port 5000. |
| 38 | + |
| 39 | +``` |
| 40 | +minikube-with-registry.sh |
| 41 | +``` |
| 42 | + |
| 43 | +4) Try pushing an image. |
| 44 | + |
| 45 | +``` |
| 46 | +docker tag alpine localhost:5000/alpine |
| 47 | +docker push localhost:5000/alpine |
| 48 | +``` |
| 49 | + |
| 50 | +You can now use the image name `localhost:5000/alpine` in any resources you deploy to the cluster. |
| 51 | + |
| 52 | +[Tilt](https://tilt.dev) will automatically detect the local registry created by this script. |
| 53 | + |
| 54 | +## Thanks to |
| 55 | + |
| 56 | +High five to [MicroK8s](https://github.com/ubuntu/microk8s) for the initial local registry feature |
| 57 | +that inspired a lot of this work. |
| 58 | + |
| 59 | +The Kind team ran with this, writing up documentation and hooks for how to [set up a local registry](https://kind.sigs.k8s.io/docs/user/local-registry/) with Kind. |
| 60 | + |
| 61 | +This repo adapts the Kind team's approach and applies the local registry configmap, so that tools |
| 62 | +like Tilt can discover the local-registry. This protocol is a [Kubernetes Enhancement Proposal](https://github.com/kubernetes/enhancements/issues/1755). |
| 63 | + |
| 64 | +## License |
| 65 | + |
| 66 | +Copyright 2020 Windmill Engineering |
| 67 | + |
| 68 | +Licensed under [the Apache License, Version 2.0](LICENSE) |
0 commit comments