OpenShift安装
安裝環境
centos 7.4 64位
關閉selinux
vim /etc/selinux/config
關閉防火墻
systemctl stop firewalld
systemctl disable firewalld
設置主機名
hostnamectl set-hostname openshift.example.com
添加主機名解析
vim /etc/hosts
10.0.0.223 openshift.example.com
安裝docker
yum install docker
systemctl enable docker
systemctl start docker
默認安裝的版本是1.12.6
添加阿里云鏡像加速器
vim /etc/docker/daemon.json
如何操作看阿里云官方文檔。
下載OpenShift
wget?
https://github.com/openshift/origin/releases/download/v3.7.0/openshift-origin-server-v3.7.0-7ed6862-linux-64bit.tar.gz解壓到/usr/local/src/openshift
編輯 /etc/profile
source /etc/profile
啟動OpenShift
openshift start&
訪問OpenShift
在訪問主機添加域名解析
sudo vim /etc/hosts
10.0.0.223 openshift.example.com
訪問https://openshift.example.com:8443
默認用戶名和密碼分別是dev, dev.
建立項目my-project
發布應用 (選擇項目右上角下拉菜單『Deploy』)
輸入openshift/hello-openshift后,單擊右邊放大鏡圖標按鈕, 然后選擇Deploy.
發布成功如下圖所示
查看service的訪問地址,并測試。
注意:只能在openshift主機上測試,因為service ip是集群范圍內的虛擬地址。
接下來添加route
1.以管理員登錄并切換到default項目
oc login -u system:admin
oc project default
2. 創建Router
oadm policy add-scc-to-user privileged system:serviceaccount:default:router
oadm router router --replicas=1 --service-account=router
3.查看router狀態
4. 添加route
在測試主機上添加域名信息
本人是MacOS
sudo vim /etc/hosts
10.0.0.223 hello.example.com
10.0.0.223 openshift.example.com
通過瀏覽器訪問service
總結
以上是生活随笔為你收集整理的OpenShift安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: kubernetes1.8.4安装指南
- 下一篇: rancher安装和使用