2016年11月22日星期二

OpenShift_009:使用 oc cluster up 一键安装 OpenShift Origin

环境: MAC OS X 10.12.1 +

1. 安装 Docker for MAC

2. 启动 Docker 后,增加一个 Insecure registries: 172.30.0.0/16


重启 Docker。

3. 安装 socat
$ brew install socat

4. 下载 oc 命令
下载地址:https://github.com/openshift/origin/releases
选择 oc for MAC:openshift-origin-client-tools-v1.4.0-rc1.b4e0954-mac.zip

5. 安装  OpenShift Origin
$ cd ~/Software/openshift/origin
$ unzip  openshift-origin-client-tools-v1.4.0-rc1.b4e0954-mac.zip
$ cp oc /usr/local/bin/
$ oc cluster up // 启动 cluster
输出如下:
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.3.2 image ... OK
-- Checking Docker daemon configuration ... OK
-- Checking for available ports ... OK
-- Checking type of volume mount ...
   Using Docker shared volumes for OpenShift volumes
-- Creating host directories ... OK
-- Finding server IP ...
   Using 10.210.8.180 as the server IP
-- Starting OpenShift container ...
   Creating initial OpenShift configuration
   Starting OpenShift using container 'origin'
   Waiting for API server to start listening
   OpenShift server started
-- Installing registry ... OK
-- Installing router ... OK
-- Importing image streams ... OK
-- Importing templates ... OK
-- Login to server ... OK
-- Creating initial project "myproject" ... OK
-- Server Information ...
   OpenShift server started.
   The server is accessible via web console at:
       https://10.210.8.180:8443

   You are logged in as:
       User:     developer
       Password: developer

   To login as administrator:
       oc login -u system:admin

$ oc login -u system:admin https://127.0.0.1:8443 // 以超级管理员账户登录
$ oc login -u devloper -p developer https://127.0.0.1:8443 // 以开发人员账户登录
给 developer 用户授超级管理员权限
$ oc login -u system:admin
$ oc adm policy add-cluster-role-to-user admin developer
访问 https://127.0.0.1:8443/console/ 账户:developer/developer



$ oc cluster down // 停止 cluster

6. 手工下载需要的其它镜像

VERSION=v1.4.1
docker pull openshift/origin-docker-registry:v1.4.1

7. 删除旧的镜像

VERSION=v1.4.0
docker rmi openshift/origin:$VERSION
docker rmi openshift/origin-deployer:$VERSION
docker rmi openshift/origin-docker-builder:$VERSION
docker rmi openshift/origin-docker-registry:$VERSION
docker rmi openshift/origin-haproxy-router:$VERSION
docker rmi openshift/origin-pod:$VERSION

参考文献:
1. https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

没有评论: