MacでOpenshift(Minishift)構築

# Install

## うまくいった手順
virtualboxはwebから持ってきてインストール

```
brew cask install minishift
minishift start --vm-driver=virtualbox
```

## 本来やりたかった手順

```
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7310c563d662ddbe094f46f9600cad30ad3551a6/Formula/docker-machine-driver-xhyve.rb
sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

brew cask install minishift
```




## Troubleshoot

### xhyve driverがない
xhyve driverがインストールされていないとminishiftインストール時に下記のエラーで詰まる


```
Checking if xhyve driver is installed ... FAIL
```


### hostの作成に失敗
xhyve driverをインストールするために下記コマンドを実行すると、
0.4.0というバージョンのdriverがインストールされるが、0.4.0にはバグがあるらしい。



```
brew info docker-machine-driver-xhyve  
```

```
-- Starting Minishift VM .... FAIL E1117 15:09:26.076541   44110 start.go:494] Error starting the VM: Error creating new host: json: cannot unmarshal bool into Go struct field Driver.Virtio9p of type []string. Retrying.
Error starting the VM: Error creating new host: json: cannot unmarshal bool into Go struct field Driver.Virtio9p of type []string
```

そのため、特定のバージョンのdriverを入れたが、今度は下記エラー...
諦めてvirtualboxを使うことにした

```
$minishift start                                                                                 
-- Starting profile 'minishift'
-- Check if deprecated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.11.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.11.0' is supported ... OK
-- Checking if requested hypervisor 'xhyve' is supported on this platform ... OK
-- Checking if xhyve driver is installed ... 
   Driver is available at /usr/local/bin/docker-machine-driver-xhyve
   Checking for setuid bit ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting the OpenShift cluster using 'xhyve' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    4 GB
   vCPUs :    2
   Disk size: 20 GB
-- Starting Minishift VM ..... FAIL E1117 15:19:34.687821   46889 start.go:494] Error starting the VM: Error creating the VM. Error with pre-create check: "Virtual Box version 4 or lower will cause a kernel panicif xhyve tries to run. You are running version: 6.0.10r132072\n\n\t Please upgrade to version 5 at https://www.virtualbox.org/wiki/Downloads". Retrying.
Error starting the VM: Error creating the VM. Error with pre-create check: "Virtual Box version 4 or lower will cause a kernel panicif xhyve tries to run. You are running version: 6.0.10r132072\n\n\t Please upgrade to version 5 at https://www.virtualbox.org/wiki/Downloads"
```


# Install完了
![minishift.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/94861/5fe5549d-7c35-dcb7-7e69-6bab637bf795.png)


# oc コマンドのInstall
下記からいい感じのをダウンロードしてPATH通す
https://github.com/openshift/origin/releases


# 動作しているPod群

```
$oc get po --all-namespaces
NAMESPACE                       NAME                                                      READY     STATUS      RESTARTS   AGE
default                         docker-registry-1-rdwjk                                   1/1       Running     0          19m
default                         persistent-volume-setup-7fcbx                             0/1       Completed   0          20m
default                         router-1-82njj                                            1/1       Running     0          20m
kube-dns                        kube-dns-545ln                                            1/1       Running     0          22m
kube-proxy                      kube-proxy-nlwbj                                          1/1       Running     0          22m
kube-system                     kube-controller-manager-localhost                         1/1       Running     0          22m
kube-system                     kube-scheduler-localhost                                  1/1       Running     0          22m
kube-system                     master-api-localhost                                      1/1       Running     1          22m
kube-system                     master-etcd-localhost                                     1/1       Running     0          22m
openshift-apiserver             openshift-apiserver-jq979                                 1/1       Running     0          22m
openshift-controller-manager    openshift-controller-manager-5hkd5                        1/1       Running     0          20m
openshift-core-operators        openshift-service-cert-signer-operator-6d477f986b-gk4hw   1/1       Running     0          22m
openshift-core-operators        openshift-web-console-operator-57986c9c4f-bxl62           1/1       Running     0          20m
openshift-service-cert-signer   apiservice-cabundle-injector-8ffbbb6dc-zcbqb              1/1       Running     0          21m
openshift-service-cert-signer   service-serving-cert-signer-668c45d5f-hm54x               1/1       Running     0          21m
openshift-web-console           webconsole-866cd5fb86-rt8kh                               1/1       Running     0          19m
```