服务器信息
在阿里云买了个抢占式的服务器,地区为华南广州,系统为Ubuntu 20.04,8核16GB。
安装Docker
命令如下:
$ apt-get update -y
$ apt-get upgrade -y
$ apt-get install -y docker.io
安装成功后,检查一下版本:
$ docker version
Client:
Version: 20.10.7
API version: 1.41
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu5~20.04.2
Built: Mon Nov 1 00:34:17 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu5~20.04.2
Built: Fri Oct 22 00:45:53 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.5.5-0ubuntu3~20.04.1
GitCommit:
runc:
Version: 1.0.1-0ubuntu2~20.04.1
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:
要修改Docker配置文件,让它可以使用私有的registry:
cat << EOF | sudo tee /etc/docker/daemon.json
{
"insecure-registries" : [ "172.30.0.0/16" ]
}
EOF
然后重启一下Docker即可:
systemctl restart docker
安装OpenShift
下载并解压对应的可执行文件:
# 下载
$ wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
# 解压
$ tar xvf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
# 复制到bin目录
$ cp openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc /usr/local/bin/
$ cp openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/kubectl /usr/local/bin/
# 检查版本
$ oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO
启动集群,第一次需要比较长的时候,因为需要下载镜像:
$ oc cluster up
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11 is available ...
Creating shared mount directory on the remote host ...
Determining server IP ...
Checking if OpenShift is already running ...
Checking for supported Docker version (=>1.22) ...
Checking if insecured registry is configured properly in Docker ...
Checking if required ports are available ...
Checking if OpenShift client is configured properly ...
Checking if image openshift/origin-control-plane:v3.11 is available ...
Starting OpenShift using openshift/origin-control-plane:v3.11 ...
I0301 22:24:39.111730 51771 flags.go:30] Running "create-kubelet-flags"
I0301 22:24:39.541760 51771 run_kubelet.go:49] Running "start-kubelet"
I0301 22:24:39.624336 51771 run_self_hosted.go:181] Waiting for the kube-apiserver to be ready ...
I0301 22:25:30.631581 51771 interface.go:26] Installing "kube-proxy" ...
I0301 22:25:30.631597 51771 interface.go:26] Installing "kube-dns" ...
I0301 22:25:30.631604 51771 interface.go:26] Installing "openshift-service-cert-signer-operator" ...
I0301 22:25:30.631609 51771 interface.go:26]