kubernetes v1.20项目之二进制部署安装docker ce

kubernetes v1.20项目之docker ce安装

k8s也将慢慢的弃用docker,这个咱不要关心了,主要是现在还是有好多的企业用的是docker引擎,主要是这个,也就是说短时间内企业还是不会淘汰docker的吧,这个安装docker和平时我们安装docker是一样的,可以参照安装docker 19版本的方法给集群的每一个机器都安装上docker,非常的简单,这个就算是一个小测试吧

下载docker 19二进制包

#我的是在master01上面操作的,只要在一台服务器上面下载就行了,没必要全部下载,一台下载完之后通过scp到其他的机器上面,不是很酷,包括docker的配置文件也是这样的操作的哟
##下载二进制包
[root@k8s-master01 ~]# wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.9.tgz

#将二进制包scp到k8s-node01
[root@k8s-master01 ~]# scp docker-19.03.9.tgz k8s-node01:~
root@k8s-node01's password: 
docker-19.03.9.tgz   

#将二进制包scp到k8s-node02上面                                                                                          100%   58MB  33.3MB/s   00:01    
[root@k8s-master01 ~]# scp docker-19.03.9.tgz k8s-node02:~
root@k8s-node02's password: 
docker-19.03.9.tgz                                                                                             100%   58MB  91.5MB/s   00:00    

##解压二进制包
[root@k8s-master01 ~]# tar zxvf docker-19.03.9.tgz

##添加到/bin目录下面,主要是有了docker命令
[root@k8s-master01 ~]# mv docker/* /usr/bin

#docker的配置文件编写
[root@k8s-master01 ~]# cat > /usr/lib/systemd/system/docker.service << EOF
> [Unit]
> Description=Docker Application Container Engine
> Documentation=https://docs.docker.com
> After=network-online.target firewalld.service
> Wants=network-online.target
> 
> [Service]
> Type=notify
> ExecStart=/usr/bin/dockerd
> ExecReload=/bin/kill -s HUP $MAINPID
> LimitNOFILE=infinity
> LimitNPROC=infinity
> LimitCORE=infinity
> TimeoutStartSec=0
> Delegate=yes
> KillMode=process
> Restart=on-failure
> StartLimitBurst=3
> StartLimitInterval=60s
> 
> [Install]
> WantedBy=multi-user.target
> EOF

#将docker配置文件scp到node01上面
[root@k8s-master01 ~]# scp /usr/lib/systemd/system/docker.service k8s-node01:/usr/lib/systemd/system/docker.service
root@k8s-node01's password: 
docker.service                                                                                                 100%  452   345.5KB/s   00:00    

#将docker配置文件scp到node02上面
[root@k8s-master01 ~]# scp /usr/lib/systemd/system/docker.service k8s-node02:/usr/lib/systemd/system/docker.service
root@k8s-node02's password: 
docker.service                                                                                                 100%  452   332.0KB/s   00:00    

#在node01上面重复master操作
[root@k8s-node01 ~]# tar zxvf docker-19.03.9.tgz
docker/
docker/docker-init
docker/runc
docker/docker
docker/docker-proxy
docker/containerd
docker/ctr
docker/dockerd
docker/containerd-shim
[root@k8s-node01 ~]# mv docker/* /usr/bin

##在node02上面重复操作
[root@k8s-node02 ~]# tar zxvf docker-19.03.9.tgz
docker/
docker/docker-init
docker/runc
docker/docker
docker/docker-proxy
docker/containerd
docker/ctr
docker/dockerd
docker/containerd-shim
[root@k8s-node02 ~]# mv docker/* /usr/bin

配置docker的阿里加速器

#在master node01 node02上面创建docker目录
[root@k8s-master01 ~]# mkdir /etc/docker
[root@k8s-node01 ~]# mkdir /etc/docker
[root@k8s-node02 ~]# mkdir /etc/docker

#在master01上面配置docker的加速器配置文件
[root@k8s-master01 ~]# cat > /etc/docker/daemon.json << EOF
> {
>   "registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"]
> }
> EOF
#复制到node01上面
[root@k8s-master01 ~]# scp /etc/docker/daemon.json k8s-node01:/etc/docker/daemon.json
root@k8s-node01's password: 
daemon.json                                                                                                    100%   67    82.0KB/s   00:00    

##复制到node02上面
[root@k8s-master01 ~]# scp /etc/docker/daemon.json k8s-node02:/etc/docker/daemon.json
root@k8s-node02's password: 
daemon.json       																								100%   67    82.0KB/s   00:00  

启动docker,并加入开机自启

##在master01上面启动docker
[root@k8s-master01 ~]# systemctl daemon-reload
[root@k8s-master01 ~]# systemctl start docker
[root@k8s-master01 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@k8s-master01 ~]# docker info   #检验一下安装docker效果,出现下面的数据,说明安装成功
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.21.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.777GiB
 Name: k8s-master01
 ID: NX55:HIPH:ZU7T:UDOF:WYPP:WP55:UTZQ:LIL7:2SRX:JL7Q:G3PL:7XXJ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://b9pmyelo.mirror.aliyuncs.com/
 Live Restore Enabled: false
 Product License: Community Engine

##在node01上面启动docker
[root@k8s-node01 ~]# systemctl daemon-reload
[root@k8s-node01 ~]# systemctl start docker
[root@k8s-node01 ~]#  systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@k8s-node01 ~]# docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.21.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.777GiB
 Name: k8s-node01
 ID: Q3IV:ISMU:MEVE:36NG:56U4:6U5C:AEUI:XVBA:YJJR:47HY:3M4K:K2SK
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://b9pmyelo.mirror.aliyuncs.com/
 Live Restore Enabled: false
 Product License: Community Engine

##在node02上面启动docker
[root@k8s-node02 ~]# systemctl daemon-reload
[root@k8s-node02 ~]# systemctl start docker
[root@k8s-node02 ~]#  systemctl enable docker
[root@k8s-node02 ~]# docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.21.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.777GiB
 Name: k8s-node02
 ID: RDTR:TOZB:WHV3:AWCY:CUEP:6XTH:GABM:VWGS:34MQ:UOIW:DEQ2:CFGQ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://b9pmyelo.mirror.aliyuncs.com/
 Live Restore Enabled: false
 Product License: Community Engine

结束语

只要安装了docker后,后面的就简单多了,加油少年
下一篇:kubernetes v1.20项目之二进制安装部署Master Node

你可能感兴趣的:(kubernetes基础操作,项目部署,日常操作,docker,k8s,kubernetes,linux,centos)