这些概念租后抽象了。现在是行动的时候了。我们将使用Minishift在您的机器上安装Openshift(https://github.com/minishift/minishift)。当然,你可以使用OpenShift Online (https://www.openshift.com/devpreview/)或者Red Hat Container Development Kit v3(https://developers.redhat.com/products/cdk/download/)。
安装Minishift(https://github.com/minishift/minishift)需要一个管理程序来运行包含OpenShift的虚拟机。根据您的主机操作系统,您可以选择管理程序;详细信息请查看Minishift安装指南。
安装Minishift,你只需要从官网下载u你的系统像匹配的最新版本(https://github.com/minishift/minis hift/releases),把它解压缩到你喜欢的位置,并将minishift添加到PATH环境变量中。一旦安装完成,就可以使用下面命令行启动:
minishift start
一旦启动了,你可以通过https://192.168.64.12:8443来访问OpenShift。您可能需要验证SSL证书。使用 developer/developer登录。
我们还需要OpenShift客户端(oc),一个用于与OpenShift实例交互的命令行实用程序。从https://github.com/openshift/origin/releases/latest下载最新版本的OpenShift客户端。将其解压缩到首选位置,并将oc二进制文件添加到PATH环境变量中。
然后,使用以下方法连接到您的OpenShift实例:
oc login https://192.168.64.12:8443 -u developer -p developer
OpenShift有一个名为project的命名空间概念。为我们将要部署的示例创建项目,执行:
oc new-project reactive-microservices
oc policy add-role-to-user admin developer -n
reactive-microservices
oc policy add-role-to-user view -n reactive-microservices
-z default
图5 - 3:创建的项目