|
1.准备:在master,node1,node2上都需要操作。
1)关闭swap交换分区:
2)修改服务器时区:
3)重启日志服务:rsyslog
4)关闭服务器 休眠 功能:
root@master:/home/student# sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
5)开启 bridge跟踪功能模块,加载br_netfilter模块:
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo sysctl --system
root@master:/home/student# cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
> net.bridge.bridge-nf-call-ip6tables = 1
> net.bridge.bridge-nf-call-iptables = 1
> EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
root@master:/home/student# sudo sysctl --system
重启系统 自动加载:
6)设置rp_filter的值
root@master:/home/student# sudo vim /etc/sysctl.d/10-network-security.conf
以上操作在master,node1,node2上配置
2.在master,node1,node2上安装docker:
直接安装即可:docker.io默认为19版
root@master:/home/student# apt list |grep docker
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
docker-compose/focal 1.25.0-1 all
docker-doc/focal-updates 19.03.8-0ubuntu1.20.04 all
docker-registry/focal 2.7.1+ds2-7 amd64
docker.io/focal-updates 19.03.8-0ubuntu1.20.04 amd64
docker2aci/focal 0.17.2+dfsg-2 amd64
docker/focal 1.5-2 all
在所有节点上安装docker:
启动docker服务并开机运行:
student@utility:~$ sudo docker version
Client:
Version: 19.03.8
API version: 1.40
Go version: go1.13.8
Git commit: afacb8b7f0
Built: Tue Jun 23 22:26:12 2020
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.13.8
Git commit: afacb8b7f0
Built: Thu Jun 18 08:26:54 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.3.3-0ubuntu2
GitCommit:
runc:
Version: spec: 1.0.1-dev
GitCommit:
docker-init:
Version: 0.18.0
GitCommit:
student@utility:~$
student@utility:~$ apt show docker.io
Package: docker.io
Version: 19.03.8-0ubuntu1.20.04
Built-Using: glibc (= 2.31-0ubuntu9)
Priority: optional
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Paul Tagliamonte <paultag@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 192 MB
Depends: adduser, containerd (>= 1.2.6-0ubuntu1~), iptables, debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.8), libdevmapper1.02.1 (>= 2:1.02.97), libseccomp2 (>= 2.1.0), libsystemd0 (>= 209~)
Recommends: ca-certificates, cgroupfs-mount | cgroup-lite, git, pigz, ubuntu-fan, xz-utils, apparmor
Suggests: aufs-tools, btrfs-progs, debootstrap, docker-doc, rinse, zfs-fuse | zfsutils
Breaks: docker (<< 1.5~)
Replaces: docker (<< 1.5~)
Homepage: https://www.docker.com/community-edition
Download-Size: 38.9 MB
APT-Manual-Installed: yes
APT-Sources: http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages
Description: Linux container runtime
Docker complements kernel namespacing with a high-level API which operates at
the process level. It runs unix processes with strong guarantees of isolation
and repeatability across servers.
.
Docker is a great building block for automating distributed systems:
large-scale web deployments, database clusters, continuous deployment systems,
private PaaS, service-oriented architectures, etc.
.
This package contains the daemon and client. Using docker.io on non-amd64 hosts
is not supported at this time. Please be careful when using it on anything
besides amd64.
.
Also, note that kernel version 3.8 or above is required for proper operation of
the daemon process, and that any lower versions may have subtle and/or glaring
issues.
N: There is 1 additional record. Please use the '-a' switch to see it
student@utility:~$
快速获取docker镜像:
配置阿里的镜像仓库:
1. 安装/升级Docker客户端
推荐安装1.10.0以上版本的Docker客户端,参考文档 docker-ce
2. 配置镜像加速器
针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://i1pfdcu7.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
在utility上配置仓库后 ,复制daemon.json到 master,node1 ,node2:
student@utility:/etc/docker$ ls
daemon.json key.json
student@utility:/etc/docker$ scp daemon.json root@master:/etc/docker/
root@master's password:
daemon.json 100% 67 64.1KB/s 00:00
student@utility:/etc/docker$ scp daemon.json root@node1:/etc/docker/
root@node1's password:
daemon.json 100% 67 57.5KB/s 00:00
student@utility:/etc/docker$ scp daemon.json root@node2:/etc/docker/
root@node2's password:
daemon.json 100% 67 42.9KB/s 00:00
student@utility:/etc/docker$
student@master:/etc/docker$ sudo systemctl daemon-reload
student@master:/etc/docker$ sudo systemctl restart docker
student@master:/etc/docker$
student@node1:~$ sudo systemctl daemon-reload
student@node1:~$ sudo systemctl restart docker
student@node2:~$ sudo systemctl daemon-reload
student@node2:~$ sudo systemctl restart docker
student@node2:~$
关于诺普
诺普(深圳)咨询服务有限公司(简称ROPU)是专注于IT运维的最佳实践与传播,提供领先于业界的“IT运维技能及厂商认证培训”,“企业IT定制化内训,以及”高校IT基础性人才的培养,与全球著名授权机构、IT厂商建立长期合作伙伴关系,旨在为企业及运维人员提升IT自动化技能,为员工的技能转型及企业数字化转型提供最具价值的培训服务。 联系我们 电话:0755-82558629;13590219869 QQ:657680025;3202130039 地址:深圳市福田区车公庙苍松大厦南座1115
专注于IT运维的最佳实践与传播长按识别
|
|