centos7.x 64位 openshift搭建

一、关闭防火墙、关闭selinux

 

 

关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭selinux
vi /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted

vi /etc/sysconfig/docker

OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
改成
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'

 

 

二、安装docker

 

yum install docker

systemctl enable docker

systemctl start docker

 三、安装openshift

 

 

wget https://github.com/openshift/origin/releases/download/v3.7.0/openshift-origin-server-v3.7.0-7ed6862-linux-64bit.tar.gz
tar zxvf openshift-origin-server-v3.7.0-7ed6862-linux-64bit.tar.gz
进入解压目录:
启动:
openshift start&

 四、客户机host

172.16.3.230 openshift.temspus.cn

 浏览器访问:https://openshift.temspus.cn:8443

开发帐号密码:dev dev

 创建管理员:

 

设置openshift 管理员admin密码
htpasswd -c /root/users.htpasswd admin
给admin添加集群管理员权限
oadm policy add-cluster-role-to-user cluster-admin admin
 可以用  admin admin 登录

 五、openshift添加scc安装权限,以便容器有权限执行

oc login -u system:admin -n default

 

Grant a Service Account Access to the Privileged SCC
First, create a service account. For example, to create service account mysvcacct in project myproject:
oc create serviceaccount gssuser -n gss
Then, add the service account to the privileged SCC.
oad3m polic3y add-scc-to-user privi3leged sys3tem:serviceaccount:myproject:mysvcacct

Enable Images to Run with USER in the Dockerfile

 To relax the security in your cluster so that images are not forced to run as a pre-allocated UID, without granting everyone access to the privileged SCC:

  1. Grant all authenticated users access to the anyuid SCC:

  1. $ oadm policy add-scc-to-group anyuid system:authenticated

 六、添加router

 通过web控制台添加routes后,需要添加router,否则会报

The route is not accepting traffic yet because it has not been admitted by a router。

docker的应用通过route将export不出去

router创建方法
为Router使用Service Account赋权
oadm policy add-scc-to-user privileged system:serviceaccount:default:router

oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:default:router
创建Router

oadm router router --replicas=1 --service-account=router --selector='region=infra'

其中 
–replicas 是一个实例,可以指定多个,分散负载 
–selector 是部署到指定的node上,可以没有,或者换成你自己的,用下面这个命令查看node的label:

oc get node --show-labels

如果node没有label,使用这个命令添加一个

oc label node node1.example.com region=infra

还有一点很重要,DNS做解析时把域名解析到router所在的node上,而不是master节点

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值