2016年3月18日星期五

OpenShift_005:离线安装 OSE 3.1 之四:安装 Node1 节点

环境:OS X EI Capitan 10.11.3 + Open Shift Enterprise 3.1

1. 网络、主机名、安全配置
 (1) 设定固定 IP 地址:vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=8fe5a4c7-fbcd-4218-8e2f-31ec4e956fa4
DEVICE=enp0s3
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.56.107
NETMASK=255.255.255.0
GATEWAY=192.168.56.1
(2) 设定 hostname
hostnamectl set-hostname node1.example.com
(3) 设定 selinux 安全级别为 permissive
sed -i 's/=enforcing/=permissive/g' /etc/selinux/config

2. 配置指向 yum 源,蓝色字体根据实际 yum 源配置修改
(1)创建 yum 源配置文件
cat << EOF > /etc/yum.repos.d/ose.repo
[OpenShift]
baseurl = http://192.168.56.105/repo/
gpgcheck = 0
enabled = 1
EOF
(2)测试确认可以获得 yum 源
yum list|grep -i atomic-openshift;

3. 安装 docker 和相应软件
 (1) 安装基础软件包
yum -y remove NetworkManager*;
yum -y install wget git net-tools bind-utils iptables-services bridge-utils bash-completion vim lrzsz unzip;
yum -y update;
yum -y install atomic-openshift-utils;
reboot;
(2) 安装 docker
yum -y install docker;
systemctl enable docker;
systemctl stop docker;
(3) 修改 docker registry 地址,蓝色字体根据实际地址修改
cp /etc/sysconfig/docker /etc/sysconfig/docker.bak.$(date "+%Y%m%d%H%M%S");
sed  -i s/".*--selinux-enabled.*"/"OPTIONS='--selinux-enabled --insecure-registry 172.30.0.0\/16 --insecure-registry registry.example.com:5000'"/g /etc/sysconfig/docker;
sed -i 's/registry.access.redhat.com/registry.example.com:5000/g' /etc/sysconfig/docker;
(4) 修改 docker 存储
cat < /etc/sysconfig/docker-storage-setup
VG=rhel
SETUP_LVM_THIN_POOL=yes
EOF
docker-storage-setup;
输出如下:// TODO 这个有没有问题?
Rounding up size to full physical extent 52.00 MiB
Volume group "rhel" has insufficient free space (11 extents): 13 required.
(4) 将 docker 的容器存储部分挂到另一个盘,蓝色字体根据实际设备修改(本次安装未执行此步)
vgextend rhel  /dev/vdb
lvextend -l +100%FREE /dev/rhel/docker-pool
(5) 重启 docker
systemctl start docker;

4. 配置 dns,蓝色字体根据实际机器 IP 和网卡名称修改
(1)配置 /etc/resolv.conf
cp /etc/resolv.conf /etc/resolv.conf.bak.$(date "+%Y%m%d%H%M%S");
sed -i '1 i\nameserver 192.168.56.105' /etc/resolv.conf;
chattr +i /etc/resolv.conf
echo "DNS1=192.168.56.105">>/etc/sysconfig/network-scripts/ifcfg-enp0s3;
(2)测试确认 dns 解析成功
dig master.example.com@192.168.56.105

5. 测试确认可以从 docker private registry 把 docker image pull 下来
docker pull registry.example.com:5000/openshift3/php-55-rhel7

6. 测试确认可以 git clone 项目代码
cd /tmp;
git clone http://git.example.com/git/cakephp.git/;

没有评论: