k8s 之docker环境部署 (三)

1.在node 21上安装docker

[root@hdss7-21 ~]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
[root@hdss7-21 ~]# mkdir -p /data/docker
[root@hdss7-21 ~]# mkdir -p /etc/docker
[root@hdss7-21 ~]# vim /etc/docker/daemon.json
[root@hdss7-21 ~]# cat /etc/docker/daemon.json 
{
  "graph": "/data/docker",
  "storage-driver": "overlay2",
  "insecure-registries": ["registry.access.redhat.com","quay.io","harbor.od.com"],
  "registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],
  "bip": "172.7.21.1/24",
  "exec-opts": ["native.cgroupdriver=systemd"],
  "live-restore": true
} 
[root@hdss7-21 ~]# systemctl start docker
[root@hdss7-21 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@hdss7-21 ~]# docker info

 

 

2.在node22上安装docker

 

[root@hdss7-22 ~]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
[root@hdss7-22 ~]# mkdir -p /etc/docker
[root@hdss7-22 ~]# mkdir -p /data/docker
[root@hdss7-22 ~]# vim /etc/docker/daemon.json
[root@hdss7-22 ~]# cat /etc/docker/daemon.json 
{
  "graph": "/data/docker",
  "storage-driver": "overlay2",
  "insecure-registries": ["registry.access.redhat.com","quay.io","harbor.od.com"],
  "registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],
  "bip": "172.7.22.1/24",
  "exec-opts": ["native.cgroupdriver=systemd"],
  "live-restore": true
}
[root@hdss7-22 ~]# systemctl start docker
[root@hdss7-22 ~]# systemctl enable docker

 

3.在node200上安装docker

[root@hdss7-200 ~]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
root@hdss7-200 ~]# mkdir -p /etc/docker
[root@hdss7-200 ~]# mkdir -p /data/docker
[root@hdss7-200 ~]# vim /etc/docker/daemon.json
[root@hdss7-200 ~]# 
[root@hdss7-200 ~]# 
[root@hdss7-200 ~]# 
[root@hdss7-200 ~]# cat /etc/docker/daemon.json 
{
  "graph": "/data/docker",
  "storage-driver": "overlay2",
  "insecure-registries": ["registry.access.redhat.com","quay.io","harbor.od.com"],
  "registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],
  "bip": "172.7.200.1/24", # 定义k8s主机上k8s pod的ip地址网段 -- 改成node节点的ip
  "exec-opts": ["native.cgroupdriver=systemd"],
  "live-restore": true
}
[root@hdss7-200 ~]# systemctl start docker
[root@hdss7-200 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@hdss7-200 ~]# docker info

 原文章已同步语雀

https://www.yuque.com/songyifei/bkxwl0/ygcgxt

原文地址:https://www.cnblogs.com/sseban/p/13054111.html