准备好本机访问科学上网环境

  1. 安装pip软件
    1
    $ yum install python2-pip
  2. 安装shadowsocks包
    1
    pip install shadowsocks -i https://pypi.douban.com/simple
  3. 编辑文件/etc/shadowsocks.json
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    $ cat > /etc/shadowsocks.json <<EOF
    {
    "server":"shadowsocks的IP",
    "server_port":8388,
    "local_address": "0.0.0.0",
    "local_port":1080,
    "password":"fuuuuuuuuuuuuckgfw",
    "timeout":300,
    "method":"rc4-md5",
    "fast_open": false
    }
    EOF
  4. 启动shadowsocks客户端
    1
    $ sslocal -c /etc/shadowsocks.json -d start
    如果需要暂停,执行以下命令
    1
    $ sudo sslocal -c /etc/shadowsocks.json -d stop
  5. 安装privoxy软件将sockets5转为http协议
    1
    2
    3
    4
    5
    6
    $ yum install privoxy
    $ cat >/etc/privoxy/config <<EOF
    forward-socks5t / 127.0.0.1:1080 .
    listen-address localhost:8118
    EOF
    $ systemctl start privoxy
  6. 设置本机的http代理服务
    1
    2
    3
    $ export http_proxy=http://localhost:8118
    $ export https_proxy=http://localhost:8118
    $ export no_proxy="registry.example.com,127.0.0.1,192.168.1.21"
    其中no_proxy为本地镜像仓库,将会用来接收OpenShift 4的官方镜像。

同步镜像

镜像同步完成后的提示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[root@registry ~]# oc adm -a ${LOCAL_SECRET_JSON} release mirror      --from=quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}      --to=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY}      --to-release-image=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY}:${OCP_RELEASE}
info: Mirroring 109 images to registry.fcloudy.com:5000/ocp4/openshift4 ...
registry.fcloudy.com:5000/

......

info: Mirroring completed in 4m46.5s (3.265MB/s)
Success
Update image: registry.fcloudy.com:5000/ocp4/openshift4:4.4.3-x86_64
Mirror prefix: registry.fcloudy.com:5000/ocp4/openshift4

To use the new mirrored repository to install, add the following section to the install-config.yaml:

imageContentSources:
- mirrors:
- registry.fcloudy.com:5000/ocp4/openshift4
source: quay.io/openshift-release-dev/ocp-release
- mirrors:
- registry.fcloudy.com:5000/ocp4/openshift4
source: quay.io/openshift-release-dev/ocp-v4.0-art-dev


To use the new mirrored repository for upgrades, use the following to create an ImageContentSourcePolicy:

apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
name: example
spec:
repositoryDigestMirrors:
- mirrors:
- registry.fcloudy.com:5000/ocp4/openshift4
source: quay.io/openshift-release-dev/ocp-release
- mirrors:
- registry.fcloudy.com:5000/ocp4/openshift4
source: quay.io/openshift-release-dev/ocp-v4.0-art-dev

检查本地镜像仓库状态

1
$ curl -u admin:admin -k https://registry.fcloudy.com:5000/v2/_catalog

下载相关的coreos文件

文件列表可参考 https://github.com/RedHatOfficial/ocp4-helpernode/blob/master/vars/main.yml
列表如下:

1
2
3
4
5
https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.4/latest/rhcos-4.4.3-x86_64-metal.x86_64.raw.gz
https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.4/latest/rhcos-4.4.3-x86_64-installer-kernel-x86_64
https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.4/latest/rhcos-4.4.3-x86_64-installer-initramfs.x86_64.img
https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.4.3/openshift-client-linux-4.4.3.tar.gz
https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.4.3/openshift-install-linux-4.4.3.tar.gz

问题

1、安装master与node节点时,需要关闭helper机器的selinux

1
$ setenforce 0

2、Vmware 节点引导使用BIOS
3、

创建机器

下载rhcos镜像地址 https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.4/latest/
通过vmware导入创建rhcos服务器,分别作为bootstrap、master、node机器。