Invoke-WebRequest -Uri $item.browser_download_url -OutFile 'c:\minikube\minikube.exe' -UseBasicParsing
Add the minikube.exe
binary to your PATH
.
Make sure to run PowerShell as Administrator.
$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine)
if ($oldPath.Split(';') -inotcontains 'C:\minikube'){
[Environment]::SetEnvironmentVariable('Path', $('{0};C:\minikube' -f $oldPath), [EnvironmentVariableTarget]::Machine)
If you used a CLI to perform the installation, you will need to close that CLI and open a new one before proceeding.
2Start your cluster
From a terminal with administrator access (but not logged in as root), run:
If minikube fails to start, see the drivers page for help setting up a compatible container or virtual-machine manager.
3Interact with your cluster
If you already have kubectl installed, you can now use it to access your shiny new cluster:
Alternatively, minikube can download the appropriate version of kubectl and you should be able to use it like this:
minikube kubectl -- get po -A
You can also make your life easier by adding the following to your shell config:
alias kubectl="minikube kubectl --"
Initially, some services such as the storage-provisioner, may not yet be in a Running state. This is a normal condition during cluster bring-up, and will resolve itself momentarily. For additional insight into your cluster state, minikube bundles the Kubernetes Dashboard, allowing you to get easily acclimated to your new environment:
4Deploy applications
Create a sample deployment and expose it on port 8080:
kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0
kubectl expose deployment hello-minikube --type=NodePort --port=8080
It may take a moment, but your deployment will soon show up when you run:
kubectl get services hello-minikube
The easiest way to access this service is to let minikube launch a web browser for you:
minikube service hello-minikube
Alternatively, use kubectl to forward the port:
kubectl port-forward service/hello-minikube 7080:8080
Tada! Your application is now available at http://localhost:7080/.
You should be able to see the request metadata in the application output. Try changing the path of the request and observe the changes. Similarly, you can do a POST request and observe the body show up in the output.
To access a LoadBalancer deployment, use the “minikube tunnel” command. Here is an example deployment:
kubectl create deployment balanced --image=kicbase/echo-server:1.0
kubectl expose deployment balanced --type=LoadBalancer --port=8080
In another window, start the tunnel to create a routable IP for the ‘balanced’ deployment:
To find the routable IP, run this command and examine the EXTERNAL-IP
column:
kubectl get services balanced
Your deployment is now available at <EXTERNAL-IP>:8080
Enable ingress addon:
minikube addons enable ingress
The following example creates simple echo-server services and an Ingress object to route to these services.
kind: Pod
apiVersion: v1
metadata:
name: foo-app
labels:
app: foo
spec:
containers:
- name: foo-app
image: 'kicbase/echo-server:1.0'
kind: Service
apiVersion: v1
metadata:
name: foo-service
spec:
selector:
app: foo
ports:
- port: 8080
kind: Pod
apiVersion: v1
metadata:
name: bar-app
labels:
app: bar
spec:
containers:
- name: bar-app
image: 'kicbase/echo-server:1.0'
kind: Service
apiVersion: v1
metadata:
name: bar-service
spec:
selector:
app: bar
ports:
- port: 8080
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
spec:
rules:
- http:
paths:
- pathType: Prefix
path: /foo
backend:
service:
name: foo-service
port:
number: 8080
- pathType: Prefix
path: /bar
backend:
service:
name: bar-service
port:
number: 8080
Apply the contents
kubectl apply -f https://storage.googleapis.com/minikube-site-examples/ingress-example.yaml
Wait for ingress address
kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
example-ingress nginx * <your_ip_here> 80 5m45s
Note for Docker Desktop Users:
To get ingress to work you’ll need to open a new terminal window and run minikube tunnel
and in the following step use 127.0.0.1
in place of <ip_from_above>
.
Now verify that the ingress works
$ curl <ip_from_above>/foo
Request served by foo-app
$ curl <ip_from_above>/bar
Request served by bar-app
5Manage your cluster
Pause Kubernetes without impacting deployed applications:
Unpause a paused instance:
Halt the cluster:
Change the default memory limit (requires a restart):
minikube config set memory 9001
Browse the catalog of easily installed Kubernetes services:
Create a second cluster running an older Kubernetes release:
minikube start -p aged --kubernetes-version=v1.16.1
Delete all of the minikube clusters:
Take the next step
The minikube handbook
Community-contributed tutorials
minikube command reference
Contributors guide
Take our fast 5-question survey to share your thoughts 🙏