centos7搭建openshift-3.11
关闭防火墙和selinux
sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
安装docker
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y install docker-ce
配置docker私有仓库地址
因为openshift安装成功后,会自行启动一个registry的私有仓库镜像以便使用,为了之后不用重新配置后还要重启docker,所以在此先行配置
集群自动启动的registry仓库地址就是172.30.x.x,所以如下配置
systemctl start docker
vim/etc/docker/daemon.json
{
"insecure-registries": ["172.30.0.0/16"]
}
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
安装包:
https://github.com/openshift/origin/releases/tag/v3.11.0
上传到安装目录,我当前是使用的root目录
解压缩并且重命名:
tar -zxvf openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.tar.gz
mv openshift-origin-server-v3.11.0-0cbc58b-linux-64bit /opt/openshift-server-v3.11.0
修改/etc/profile,加入环境变量
PATH=$PATH:/opt/openshift-server-v3.11.0/
source /etc/profile
启动集群
oc cluster up --skip-registry-check=true --public-hostname="192.168.30.17" --no-proxy="192.168.30.17"
参数介绍:
skip-registry-check 代表是否跳过Docker守护进程注册表什么的检查
public-hostname 代表暴露在外部供访问的地址
no-proxy 代表哪些地址不需要转发(如果不加这个,有可能部署成功后访问地址会转发到 localhost 127.0.0.1)
启动成功的最后会有这个输出
plates/nodejs quickstart" "sample-templates/rails quickstart" "sample-templates/jenkins pipeline ephemeral" "sample-templates/sample pipeline" "sample-templates/mongodb" "sample-templates/mysql" "sample-templates/cakephp quickstart" "sample-templates/dancer quickstart"
I1217 09:17:15.503518 24655 interface.go:41] Finished installing "openshift-router" "centos-imagestreams" "openshift-image-registry" "openshift-web-console-operator" "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.30.17:8443
You are logged in as:
User: developer
Password: <any value>
To login as administrator:
oc login -u system:admin