1. 概述
mac下使用minishift的方式在本地安装openshift
2. 配置xhyve Driver
Minishift is currently tested against docker-machine-driver-xhyve version 0.3.3.
Use the following command to install the latest version of the driver with Homebrew:
$ brew install docker-machine-driver-xhyve
Once installed, enable root access for the docker-machine-driver-xhyve binary and add it to the default wheel group:
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-
driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chown root:wheel /usr/local/bin/docker-machine-driver-hyperkit && sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit
Set the owner User ID (SUID) for the binary as follows:
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
centeros7
curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-centos7 > /usr/local/bin/docker-machine-driver-kvm \
chmod +x /usr/local/bin/docker-machine-driver-kvm
3. 安装minishift
- 工程链接 Mnishift Github Release Page
- macos包 minishift-1.17.0-darwin-amd64.tgz.
可以先下载macos包并解压
wget https://github.com/minishift/minishift/releases/download/v1.17.0/minishift-1.17.0-darwin-amd64.tgz && tar xvf minishift-1.17.0-darwin-amd64.tgz && cd minishift-1.17.0-darwin-amd64
4. 初始化openshift
./minishift start
-- Starting Minishift VM .... FAIL E0606 15:41:24.144140 6352 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
报这个错的时候,需要执行
./minishift start --vm-driver hyperkit
5.命令行登入
oc login -u system:admin https://192.168.1.105:8443
6.网页登入
首先关闭服务
minishift stop
启动为页面版
minishift console
- 访问账户:system/admin 或 developer/developer
- 地址: https://192.168.1.105:8443/console/
7. 启用插件
Minishift 预置了若干插件来按需对虚拟机内部运行的 OpenShift Origin 进行个性化。
使用以下命令查看当前插件的启用状态:
$ minishift addon list
使用以下命令启用一个插件,例如我想要启用 anyuid 插件:
$ minishift addon enable anyuid
完整安装日志如下:
bogon:minishift-1.17.0-darwin-amd64 mac$ minishift start --vm-driver hyperkit
-- 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 'hyperkit' is supported on this platform ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting the OpenShift cluster using 'hyperkit' hypervisor ...
-- Minishift VM will be configured with ...
Memory: 4 GB
vCPUs : 2
Disk size: 20 GB
-- Starting Minishift VM ................... OK
-- Checking for IP address ... OK
-- Checking for nameservers ... OK
-- Checking if external host is reachable from the Minishift VM ...
Pinging 8.8.8.8 ... OK
-- Checking HTTP connectivity from the VM ...
Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 1% used OK
-- Writing current configuration for static assignment of IP address ... OK
Importing 'openshift/origin-control-plane:v3.11.0' . CACHE MISS
Importing 'openshift/origin-docker-registry:v3.11.0' . CACHE MISS
Importing 'openshift/origin-haproxy-router:v3.11.0' CACHE MISS
-- OpenShift cluster will be configured with ...
Version: v3.11.0
-- Pulling the OpenShift Container Image .......................................................................... OK
-- Copying oc binary from the OpenShift container image to VM ... OK
-- Starting OpenShift cluster ............................................................................
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11.0 is available ...
Pulling image openshift/origin-cli:v3.11.0
E0622 22:45:09.568552 4272 helper.go:173] Reading docker config from /home/docker/.docker/config.json failed: open /home/docker/.docker/config.json: no such file or directory, will attempt to pull image docker.io/openshift/origin-cli:v3.11.0 anonymously
Image pull complete
Pulling image openshift/origin-node:v3.11.0
E0622 22:45:22.225962 4272 helper.go:173] Reading docker config from /home/docker/.docker/config.json failed: open /home/docker/.docker/config.json: no such file or directory, will attempt to pull image docker.io/openshift/origin-node:v3.11.0 anonymously
Pulled 5/6 layers, 85% complete
Pulled 6/6 layers, 100% complete
Extracting
Image pull complete
Checking type of volume mount ...
Determining server IP ...
Using public hostname IP 192.168.64.2 as the host IP
Checking if OpenShift is already running ...
Checking for supported Docker version (=>1.22) ...
Checking if insecured registry is configured properly in Docker ...
Checking if required ports are available ...
Checking if OpenShift client is configured properly ...
Checking if image openshift/origin-control-plane:v3.11.0 is available ...
Starting OpenShift using openshift/origin-control-plane:v3.11.0 ...
I0622 22:46:05.600894 4272 config.go:40] Running "create-master-config"
I0622 22:46:08.826968 4272 config.go:46] Running "create-node-config"
I0622 22:46:10.168746 4272 flags.go:30] Running "create-kubelet-flags"
I0622 22:46:10.775571 4272 run_kubelet.go:49] Running "start-kubelet"
I0622 22:46:11.050312 4272 run_self_hosted.go:181] Waiting for the kube-apiserver to be ready ...
I0622 22:48:11.081505 4272 interface.go:26] Installing "kube-proxy" ...
I0622 22:48:11.081575 4272 interface.go:26] Installing "kube-dns" ...
I0622 22:48:11.081585 4272 interface.go:26] Installing "openshift-service-cert-signer-operator" ...
I0622 22:48:11.081591 4272 interface.go:26] Installing "openshift-apiserver" ...
I0622 22:48:11.081781 4272 apply_template.go:81] Installing "openshift-apiserver"
I0622 22:48:11.081785 4272 apply_template.go:81] Installing "kube-dns"
I0622 22:48:11.088129 4272 apply_template.go:81] Installing "openshift-service-cert-signer-operator"
I0622 22:48:11.088561 4272 apply_template.go:81] Installing "kube-proxy"
I0622 22:48:18.976184 4272 interface.go:41] Finished installing "kube-proxy" "kube-dns" "openshift-service-cert-signer-operator" "openshift-apiserver"
I0622 22:50:45.025424 4272 run_self_hosted.go:242] openshift-apiserver available
I0622 22:50:45.025809 4272 interface.go:26] Installing "openshift-controller-manager" ...
I0622 22:50:45.026002 4272 apply_template.go:81] Installing "openshift-controller-manager"
I0622 22:50:49.870400 4272 interface.go:41] Finished installing "openshift-controller-manager"
Adding default OAuthClient redirect URIs ...
Adding web-console ...
Adding centos-imagestreams ...
Adding registry ...
Adding router ...
Adding sample-templates ...
Adding persistent-volumes ...
I0622 22:50:49.900126 4272 interface.go:26] Installing "openshift-web-console-operator" ...
I0622 22:50:49.900167 4272 interface.go:26] Installing "centos-imagestreams" ...
I0622 22:50:49.900180 4272 interface.go:26] Installing "openshift-image-registry" ...
I0622 22:50:49.900196 4272 interface.go:26] Installing "openshift-router" ...
I0622 22:50:49.900211 4272 interface.go:26] Installing "sample-templates" ...
I0622 22:50:49.900222 4272 interface.go:26] Installing "persistent-volumes" ...
I0622 22:50:49.901464 4272 apply_template.go:81] Installing "openshift-web-console-operator"
I0622 22:50:49.901683 4272 apply_list.go:67] Installing "centos-imagestreams"
I0622 22:50:49.903042 4272 interface.go:26] Installing "sample-templates/mongodb" ...
I0622 22:50:49.903059 4272 interface.go:26] Installing "sample-templates/mariadb" ...
I0622 22:50:49.903068 4272 interface.go:26] Installing "sample-templates/cakephp quickstart" ...
I0622 22:50:49.903074 4272 interface.go:26] Installing "sample-templates/django quickstart" ...
I0622 22:50:49.903080 4272 interface.go:26] Installing "sample-templates/nodejs quickstart" ...
I0622 22:50:49.903086 4272 interface.go:26] Installing "sample-templates/jenkins pipeline ephemeral" ...
I0622 22:50:49.903092 4272 interface.go:26] Installing "sample-templates/mysql" ...
I0622 22:50:49.903097 4272 interface.go:26] Installing "sample-templates/postgresql" ...
I0622 22:50:49.903103 4272 interface.go:26] Installing "sample-templates/dancer quickstart" ...
I0622 22:50:49.903108 4272 interface.go:26] Installing "sample-templates/rails quickstart" ...
I0622 22:50:49.903114 4272 interface.go:26] Installing "sample-templates/sample pipeline" ...
I0622 22:50:49.903249 4272 apply_list.go:67] Installing "sample-templates/sample pipeline"
I0622 22:50:49.903521 4272 apply_list.go:67] Installing "sample-templates/mongodb"
I0622 22:50:49.903675 4272 apply_list.go:67] Installing "sample-templates/mariadb"
I0622 22:50:49.903838 4272 apply_list.go:67] Installing "sample-templates/cakephp quickstart"
I0622 22:50:49.903983 4272 apply_list.go:67] Installing "sample-templates/django quickstart"
I0622 22:50:49.904107 4272 apply_list.go:67] Installing "sample-templates/nodejs quickstart"
I0622 22:50:49.904242 4272 apply_list.go:67] Installing "sample-templates/jenkins pipeline ephemeral"
I0622 22:50:49.904368 4272 apply_list.go:67] Installing "sample-templates/mysql"
I0622 22:50:49.904488 4272 apply_list.go:67] Installing "sample-templates/postgresql"
I0622 22:50:49.904603 4272 apply_list.go:67] Installing "sample-templates/dancer quickstart"
I0622 22:50:49.904732 4272 apply_list.go:67] Installing "sample-templates/rails quickstart"
I0622 22:51:09.812261 4272 interface.go:41] Finished installing "sample-templates/mongodb" "sample-templates/mariadb" "sample-templates/cakephp quickstart" "sample-templates/django quickstart" "sample-templates/nodejs quickstart" "sample-templates/jenkins pipeline ephemeral" "sample-templates/mysql" "sample-templates/postgresql" "sample-templates/dancer quickstart" "sample-templates/rails quickstart" "sample-templates/sample pipeline"
I0622 22:51:47.083507 4272 interface.go:41] Finished installing "openshift-web-console-operator" "centos-imagestreams" "openshift-image-registry" "openshift-router" "sample-templates" "persistent-volumes"
Login to server ...
Creating initial project "myproject" ...
Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://192.168.64.2:8443/console
You are logged in as:
User: developer
Password: <any value>
To login as administrator:
oc login -u system:admin
-- Exporting of OpenShift images is occuring in background process with pid 67882.