跨过Mesos直接在CentOS上部署OpenShift,由Kubernetes管理Docker集群。

参考架构

OpenShift

更多OpenShift细节>>>

使用Minishift快速部署。

$ brew install --HEAD xhyve
$ brew cask install minishift
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ minishift start
$ minishift oc-env
$ oc new-app https://github.com/openshift/nodejs-ex -l name=myapp
$ oc logs -f bc/nodejs-ex
$ oc expose svc/nodejs-ex
$ minishift openshift service nodejs-ex --in-browser
$ minishift stop

minishift start的结果

Image pull complete

OpenShift server started.

The server is accessible via web console at:

https://192.168.64.2:8443

You are logged in as:

User:     developer

Password: <any value>

To login as administrator:

oc login -u system:admin

Could not set oc CLI context for: minishift

https://192.168.64.2:8443 system/admin

正在部署一个Java应用

openshift-jee

App运行

openshift-jee-02

在192.168.0.249通过minishift的方式安装openshift,遇到以下问题:minishift Checking if Libvirt default network is active … FAIL 

通过下载其它用户提供的minishift版本,问题解决。

minishift oc-env

export PATH=”/root/.minishift/cache/oc/v3.6.0:$PATH”

存在的问题无法Pulling image openshift/origin:v3.6.0,反复minishift stop & minishift strt

或直接下载OpenShift Origin安装包直接安装。

wget https://github.com/openshift/origin/releases/download/v3.7.1/openshift-origin-server-v3.7.1-ab0f056-linux-64bit.tar.gz

ln -s openshift-origin-server-v3.7.1-ab0f056-linux-64bit /opt/openshift

vim /etc/profile

PATH=$PATH:/opt/openshift/

source /etc/profile

openshift version

openshift start

启动存在的问题

created clusterrolebinding.rbac.authorization.k8s.io/system:openshift:controller:deployer-controller

F0228 11:12:06.622842    6175 node.go:264] failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: “systemd” is different from docker cgroup driver: “cgroupfs”

vim /etc/docker/daemon.json

“exec-opts”: [“native.cgroupdriver=systemd”]

$ cat /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd --storage-driver=overlay

OK

https://192.168.0.249:8443

dev/dev

openshift-01

openshift-02

创建本地镜像仓库

openshift-03

openshift-04

web控制面板出现

openshift-05

172.30.2.245:5000Push image出错

error: build error: Failed to push image: Get https://172.30.2.245:5000/v1/_ping:http: server gave HTTP response to HTTPS client

需修改docker的配置让docker以非https的方式连接到registry。

[[email protected] system]# vim /etc/docker/daemon.json 注意后面有,

{

“registry-mirrors”: [“https://registry.docker-cn.com“],

“insecure-registry”: [“https://172.30.0.0/16“],

“exec-opts”: [“native.cgroupdriver=systemd”]

}

修改 “insecure-registry”: [“https://172.30.0.0/16“], 为

“insecure-registries”: [“172.30.2.245:5000”],

然后 systemctl daemon-reload & systemctl restart docker

镜像发布成功

openshift-06

参考 https://github.com/openshift/origin/tree/master/examples 多实验一些例子。

使用Cockpit管理OpenShift集群和容器

openshift-07

root:123456

使用APIMan做API网关,服务治理。

http://www.apiman.io/

oc new-app apiman/on-wildfly10:1.3.1.Final 或

https://github.com/openshift/origin-apiman

传统安装 http://www.apiman.io/latest/installation-guide.html

kong拥有更多优势,使用kong

https://github.com/john-deng/kong-openshift


发表评论

OpenID

电子邮件地址不会被公开。 必填项已用*标注

Anonymous

电子邮件地址不会被公开。 必填项已用*标注