Run Kubernetes locally
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.
- VirtualBox or VMware Fusion installation
- VT-x/AMD-v virtualization must be enabled in BIOS
See the installation instructions for the latest release.
Here's a brief demo of minikube usage. We're using the code from this Kubernetes tutorial.
If you want to change the VM driver to VMware Fusion add the --vm-driver=vmwarefusion
flag to minikube start
.
Note that the IP below is dynamic and can change. It can be retrieved with minikube ip
.
$ minikube start
Starting local Kubernetes cluster...
Running pre-create checks...
Creating machine...
Starting local Kubernetes cluster...
Kubernetes is available at https://192.168.99.100:443.
$ eval $(minikube docker-env)
$ docker build -t helloworld .
Successfully built d16fe85e1abe
$ kubectl run hello-minikube --image=helloworld --hostport=8000 --port=8080 --generator=run-pod/v1
pod "hello-minikube" created
$ curl http://$(minikube ip):8000
Hello World!
$ minikube stop
Stopping local Kubernetes cluster...
Stopping "minikubeVM"...
For a list of minikube's available commands see: minikube docs
To access the dashboard, run this command in a shell after starting minikube to get the address:
echo $(minikube ip):$(kubectl get service kubernetes-dashboard --namespace=kube-system -o=jsonpath='{.spec.ports[0].nodePort}{"\n"}')
And then copy/paste that into your browser.
- Minikube packages and configures a Linux VM, Docker and all Kubernetes components, optimized for local development.
- Minikube supports Kubernetes features such as:
- DNS
- NodePorts
- ConfigMaps and Secrets
- Dashboards
- Features that require a Cloud Provider will not work in Minikube. These include:
- LoadBalancers
- PersistentVolumes
- Ingress
- Features that require multiple nodes. These include:
- Advanced scheduling policies
- DaemonSets
- Alternate runtimes, like rkt.
If you need these features, don't worry! We're planning to add these to minikube over time. Please leave a note in the issue tracker about how you'd like to use minikube!
Minikube uses libmachine for provisioning VMs, and localkube (originally written and donated to this project by RedSpread) for running the cluster.
For more information about minikube, see the proposal.
For the goals and non-goals of the minikube project, please see our roadmap.
See CONTRIBUTING.md for an overview of how to send pull requests.
- A recent Go distribution (>1.6)
- If you're not on Linux, you'll need a Docker installation
- Minikube requires at least 4GB of RAM to compile, which can be problematic when using docker-machine
make out/minikube
Start the cluster using your built minikube with:
$ ./out/minikube start
Unit tests are run on Travis before code is merged. To run as part of a development cycle:
make test
Integration tests are currently run manually. To run them, build the binary and run the tests:
make integration
These are kubernetes tests that run against an arbitrary cluster and exercise a wide range of kubernetes features. You can run these against minikube by following these steps:
- Clone the kubernetes repo somewhere on your system.
- Run
make quick-release
in the k8s repo. - Start up a minikube cluster with:
minikube start
. - Set these two environment variables:
export KUBECONFIG=$HOME/.kube/config
export KUBERNETES_CONFORMANCE_TEST=y
- Run the tests (from the k8s repo):
go run hack/e2e.go -v --test --test_args="--ginkgo.focus=\[Conformance\]" --check_version_skew=false --check_node_count=false
Contributions, questions, and comments are all welcomed and encouraged! minkube developers hang out on Slack in the #minikube channel (get an invitation here). We also have the kubernetes-dev Google Groups mailing list. If you are posting to the list please prefix your subject with "minikube: ".