4.在所有节点上安装 dokcer-ce。并在 harbor 节点安装 harbor 仓库,显现正常登录 horbor 仓库
4.1 docker的安装(每个节点都要装)
yum install -y yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install -y docker-ce docker-ce-cli containerd.io systemctl start docker systemctl enable docker、
4.2运行hello0-world镜像来检验docker是否安装完成
docker run hello-world、
4.3安装 harbor 仓库
4.3.1下载,解压haror
yum install wget -y wget https://ghproxy.com/https://github.com/goharbor/harbor/releases/download/v2.6.1/harbor-offline-installer-v2.6.1.tgz tar -zxvf harbor-offline-installer-v2.6.1.tgz -C /usr/local/
4.3.2配置harbor
cd /usr/local/harbor/ cp harbor.yml.tmpl harbor.yml
vi harbor.yml
修改以下内容:
hostname = 10.0.0.30 port: 8081
注释掉以下内容:
# https related config # https: # # https port for harbor, default is 443 # port: 443 # # The path of cert and key files for nginx # certificate: /your/certificate/path # private_key: /your/private/key/path
4.3.3启动harbor(启动前需要安装docker compose)
./install.sh
4.4登录 horbor 仓库
根据在harbor.yml文件中配置的端口与IP地址(或域名)进行访问
5.修改默认 docker 仓库为 horbor 地址,修改 docker 启动引擎为 systemd
5.1修改默认 docker 仓库为 horbor 地址
修改daemon.json文件(所有节点都要执行)
vi /etc/docker/daemon.json
添加如下内容:
{ "registry-mirrors": ["https://cyowm7vy.mirror.aliyuncs.com"] } {"insecure-registries":["10.0.0.30:80"]}
重新加载配置并重启docker服务
systemctl daemon-reload systemctl restart docker
5.2修改 docker 启动引擎为 systemd
vi /etc/docker/daemon.json
添加如下内容:
{ "exec-opts": ["native.cgroupdriver=systemd"] }
重启docker服务
systemctl daemon-reload systemctl restart docker
6.安装docker-compose
6.1下载docker-compose
yum install docker-compose -y
6.2测试是否安装成功
docker-compose version
7.在 master 及 node 节点安装 Kubeadm 工具并设置开机自动启动
7.1配置kubernetes阿里源(所有节点)
vi /etc/yum.repos.d/kubernetes.repo
内容如下:
[kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=0 repo_gpgcheck=0 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
7.2安装 kubeadm, kubelet 和 kubectl(所有节点)
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
7.3设置开机自启(所有节点)
systemctl enable --now kubelet