Minikube をインストールする

Minikube をインストールしてみた。

事前準備

Minikube には kubectl が同梱されていないので、事前に kubectl をインストールする。

1
2
3
$ 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 install kubectl /usr/local/bin/

Minikube をインストールする

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ chmod +x minikube
$ sudo install minikube /usr/local/bin/
$ sudo minikube start --vm-driver=none
* minikube v1.6.2 on Ubuntu 18.04 (vbox/amd64)
* Selecting 'none' driver from user configuration (alternates: [])
* Running on localhost (CPUs=2, Memory=3944MB, Disk=8785MB) ...
* OS release is Ubuntu 18.04.2 LTS
* Preparing Kubernetes v1.17.0 on Docker '18.09.6' ...
- kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
* Downloading kubeadm v1.17.0
* Downloading kubelet v1.17.0
* Pulling images ...
* Launching Kubernetes ...
* Configuring local host environment ...
*
! The 'none' driver provides limited isolation and may reduce system security
and reliability.
! For more information, see:
- https://minikube.sigs.k8s.io/docs/reference/drivers/none/
*
! kubectl and minikube configuration will be stored in /home/foo
! To use kubectl or minikube commands as your own user, you may need to
relocate them. For example, to overwrite your own settings, run:
*
- sudo mv /home/foo/.kube /home/foo/.minikube $HOME
- sudo chown -R $USER $HOME/.kube $HOME/.minikube
*
* This can also be done automatically by setting the env var
CHANGE_MINIKUBE_NONE_USER=true
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"
* For best results, install kubectl:
https://kubernetes.io/docs/tasks/tools/install-kubectl/

オプションについて

–vm-driver で使用する仮想化技術を選択する。選択できる種類は、minikube start –help で確認できる。

1
--vm-driver='': Driver is one of: [virtualbox vmwarefusion hyperv vmware] (defaults to auto-detect)

確認する

Minikube がインストールできたことを確認するために、バージョンを表示してみる。

1
2
3
$ sudo minikube version
minikube version: v1.6.2
commit: 54f28ac5d3a815d1196cd5d57d707439ee4bb392

続いて、状態を確認する。

1
2
3
4
5
$ sudo minikube status
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

kubecrl でも状態を確認する。

1
2
3
>kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186xxxxxxxx", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186xxxxxxxx", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

クラスター情報を確認する。

1
2
3
4
5
>kubectl cluster-info
Kubernetes master is running at https://192.168.99.101:8443
KubeDNS is running at https://192.168.99.101:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

ノード情報を確認する。

1
2
3
>kubectl get node
NAME STATUS ROLES AGE VERSION
minikube Ready master 20d v1.17.0

Namespace 情報を確認する。

1
2
3
4
5
6
7
>kubectl get namespace
NAME STATUS AGE
default Active 21d
kube-node-lease Active 21d
kube-public Active 21d
kube-system Active 21d
kubernetes-dashboard Active 20d

*Minikube を停止する

1
2
3
>minikube stop
* Stopping "minikube" in virtualbox ...
* "minikube" stopped.