Minikube in der VirtualBox

Installation

VirtualBox

$ sudo apt-get install virtualbox virtualbox-dkms

Kubectl

$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl

MiniKube

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

Start

$ minikube start

Netzwerk-Trouble

No Route to MiniKube

$ sudo ip link set up vboxnet1

Service Liste

$ minikube service list
|-------------|----------------------|-----------------------------|
|  NAMESPACE  |         NAME         |             URL             |
|-------------|----------------------|-----------------------------|
| default     | kubernetes           | No node port                |
| kube-system | kube-dns             | No node port                |
| kube-system | kubernetes-dashboard | http://192.168.99.100:30000 |
|-------------|----------------------|-----------------------------|

Ein erster Pod

$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
deployment "hello-minikube" created
$ kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed
$ kubectl get pod
NAME                              READY     STATUS              RESTARTS   AGE
hello-minikube-938614450-v48hc   1/1       ContainerCreating   0          4s
$ sleep 10
$ kubectl get pod
NAME                              READY     STATUS    RESTARTS   AGE
hello-minikube-938614450-v48hc   1/1       Running   0          15s

Service Liste

$ minikube service list
|-------------|----------------------|-----------------------------|
|  NAMESPACE  |         NAME         |             URL             |
|-------------|----------------------|-----------------------------|
| default     | hello-minikube       | http://192.168.99.100:32499 |
| default     | kubernetes           | No node port                |
| kube-system | kube-dns             | No node port                |
| kube-system | kubernetes-dashboard | http://192.168.99.100:30000 |
|-------------|----------------------|-----------------------------|

Service Test

$ minikube service hello-minikube --url
http://192.168.99.100:32499
$ curl -i $($ minikube service hello-minikube --url)
HTTP/1.1 200 OK
Server: nginx/1.10.0
Date: Tue, 25 Jul 2017 11:12:24 GMT
Content-Type: text/plain
Content-Length: 318
Proxy-Connection: keep-alive

CLIENT VALUES:
client_address=172.17.0.1
command=GET
real path=/
query=nil
request_version=1
request_uri=http://192.168.99.100:8080/

SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001

HEADERS RECEIVED:
accept=*/*
connection=keep-alive
host=192.168.99.100:32499
user-agent=curl/7.52.1
BODY:
-no body in request-