MiniKube: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
(Created page with "Notes [https://kubernetes.io/docs/getting-started-guides/minikube/] [https://kubernetes.io/docs/concepts/containers/images/#using-a-private-registry] [https://kubernetes.io/do...")
 
(fix syntax for MiniKube)
 
Line 4: Line 4:


=Install kubectl=
=Install kubectl=
<syntaxhighlight>
<syntaxhighlight lang=bash>
sudo snap install juju --classic
sudo snap install juju --classic
sudo snap install kubectl --classic
sudo snap install kubectl --classic
Line 11: Line 11:
=Install and place minikube=
=Install and place minikube=
Drop into /usr/local/bin/minikube
Drop into /usr/local/bin/minikube
<syntaxhighlight>
<syntaxhighlight lang=bash>
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
</syntaxhighlight>
</syntaxhighlight>


=Start Minikube with VirtualBox=
=Start Minikube with VirtualBox=
<syntaxhighlight>
<syntaxhighlight lang=bash>
minikube start --vm-driver=virtualbox
minikube start --vm-driver=virtualbox
</syntaxhighlight>
</syntaxhighlight>


=Setup environment=
=Setup environment=
<syntaxhighlight>
<syntaxhighlight lang=bash>
eval $(minikube docker-env)
eval $(minikube docker-env)
docker ps
docker ps
Line 27: Line 27:


=Add bash completion for minikube and kubectl=
=Add bash completion for minikube and kubectl=
<syntaxhighlight>
<syntaxhighlight lang=bash>
kubectl completion bash >> ~/.bash_completion
kubectl completion bash >> ~/.bash_completion
minikube completion bash >> ~/.bash_completion
minikube completion bash >> ~/.bash_completion
Line 34: Line 34:


=Start a sample container=
=Start a sample container=
<syntaxhighlight>
<syntaxhighlight lang=bash>
drew@drew-8570w:~$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port 8080
drew@drew-8570w:~$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port 8080
deployment "hello-minikube" created
deployment "hello-minikube" created
Line 40: Line 40:


==Expose an endpoint into the container==
==Expose an endpoint into the container==
<syntaxhighlight>
<syntaxhighlight lang=bash>
drew@drew-8570w:~$ kubectl expose deployment hello-minikube --type=NodePort
drew@drew-8570w:~$ kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed
service "hello-minikube" exposed
Line 53: Line 53:
=Notes=
=Notes=
Start, drop, delete, checkout k8s dashboard, status, etc:
Start, drop, delete, checkout k8s dashboard, status, etc:
<syntaxhighlight>
<syntaxhighlight lang=bash>
minikube get-k8s-versions
minikube get-k8s-versions



Latest revision as of 23:03, 24 January 2018

Notes [1] [2] [3]

Ubuntu Minikube VirtualBox

Install kubectl

sudo snap install juju --classic
sudo snap install kubectl --classic

Install and place minikube

Drop into /usr/local/bin/minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

Start Minikube with VirtualBox

minikube start --vm-driver=virtualbox

Setup environment

eval $(minikube docker-env)
docker ps

Add bash completion for minikube and kubectl

kubectl completion bash >> ~/.bash_completion
minikube completion bash >> ~/.bash_completion
source ~/.bash_profile

Start a sample container

drew@drew-8570w:~$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port 8080
deployment "hello-minikube" created

Expose an endpoint into the container

drew@drew-8570w:~$ kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed
drew@drew-8570w:~$ kubectl get pod
NAME                              READY     STATUS    RESTARTS   AGE
hello-minikube-7844bdb9c6-ntm28   1/1       Running   0          30s

drew@drew-8570w:~$ curl $(minikube service hello-minikube --url)
 curl http://192.168.99.100:31919

Notes

Start, drop, delete, checkout k8s dashboard, status, etc:

minikube get-k8s-versions

minikube stop

minikube delete

minikube dashboard

minikube status