快速部署一个kubernetes集群
创新互联主营浮山网站建设的网络公司,主营网站建设方案,成都App制作,浮山h5微信小程序搭建,浮山网站营销推广欢迎浮山等地区企业咨询
k8s-master上面的步骤:
[root@k8s-master ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.111 k8s-master
192.168.1.112 k8s-node1
192.168.1.113 k8s-node2
[root@k8s-master ~]# cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
[root@k8s-master ~]# cat /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
[root@k8s-master ~]# sysctl --system
* Applying /usr/lib/sysctl.d/00-system.conf ...
* Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
kernel.yama.ptrace_scope = 0
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.d/k8s.conf ...
* Applying /etc/sysctl.conf ...
[root@k8s-master ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
--2020-02-12 10:07:18-- https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 119.96.207.102, 119.96.207.101, 116.211.224.248, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|119.96.207.102|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2640 (2.6K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/docker-ce.repo’
100%[======================================>] 2,640 --.-K/s in 0s
2020-02-12 10:07:18 (716 MB/s) - ‘/etc/yum.repos.d/docker-ce.repo’ saved [2640/2640]
[root@k8s-master ~]# yum list docker-ce --showduplicates | sort -r
* updates: mirrors.aliyun.com
Loaded plugins: fastestmirror
* extras: mirrors.aliyun.com
docker-ce.x86_64 3:19.03.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.0-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
Determining fastest mirrors
* base: mirrors.aliyun.com
Available Packages
[root@k8s-master ~]# yum -y install docker-ce-18.09.9-3.el7
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:18.09.9-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Processing Dependency: containerd.io >= 1.2.2-3 for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Processing Dependency: libcgroup for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.107-3.el7 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.107-3.el7.noarch
---> Package containerd.io.x86_64 0:1.2.10-3.2.el7 will be installed
---> Package docker-ce-cli.x86_64 1:19.03.5-3.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-33.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-ce x86_64 3:18.09.9-3.el7 docker-ce-stable 21 M
Installing for dependencies:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
container-selinux noarch 2:2.107-3.el7 extras 39 k
containerd.io x86_64 1.2.10-3.2.el7 docker-ce-stable 23 M
docker-ce-cli x86_64 1:19.03.5-3.el7 docker-ce-stable 39 M
libcgroup x86_64 0.41-21.el7 base 66 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
policycoreutils-python x86_64 2.5-33.el7 base 457 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
Transaction Summary
================================================================================
Install 1 Package (+10 Dependent packages)
Total download size: 85 M
Installed size: 354 M
Downloading packages:
(1/11): container-selinux-2.107-3.el7.noarch.rpm | 39 kB 00:00
(2/11): audit-libs-python-2.8.5-4.el7.x86_64.rpm | 76 kB 00:00
(3/11): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:01
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.09.9-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.09.9-3.el7.x86_64.rpm is not installed
(4/11): docker-ce-18.09.9-3.el7.x86_64.rpm | 21 MB 00:49
(5/11): libcgroup-0.41-21.el7.x86_64.rpm | 66 kB 00:01
(6/11): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00
(7/11): libsemanage-python-2.5-14.el7.x86_64.rpm | 113 kB 00:02
(8/11): containerd.io-1.2.10-3.2.el7.x86_64.rpm | 23 MB 00:52
(9/11): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:01
(10/11): policycoreutils-python-2.5-33.el7.x86_64.rpm | 457 kB 00:04
(11/11): docker-ce-cli-19.03.5-3.el7.x86_64.rpm | 39 MB 00:26
--------------------------------------------------------------------------------
Total 1.1 MB/s | 85 MB 01:15
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm)
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libcgroup-0.41-21.el7.x86_64 1/11
Installing : setools-libs-3.3.8-4.el7.x86_64 2/11
Installing : 1:docker-ce-cli-19.03.5-3.el7.x86_64 3/11
Installing : audit-libs-python-2.8.5-4.el7.x86_64 4/11
Installing : python-IPy-0.75-6.el7.noarch 5/11
Installing : libsemanage-python-2.5-14.el7.x86_64 6/11
Installing : checkpolicy-2.5-8.el7.x86_64 7/11
Installing : policycoreutils-python-2.5-33.el7.x86_64 8/11
Installing : 2:container-selinux-2.107-3.el7.noarch 9/11
setsebool: SELinux is disabled.
Installing : containerd.io-1.2.10-3.2.el7.x86_64 10/11
Installing : 3:docker-ce-18.09.9-3.el7.x86_64 11/11
Verifying : checkpolicy-2.5-8.el7.x86_64 1/11
Verifying : policycoreutils-python-2.5-33.el7.x86_64 2/11
Verifying : libsemanage-python-2.5-14.el7.x86_64 3/11
Verifying : 2:container-selinux-2.107-3.el7.noarch 4/11
Verifying : 3:docker-ce-18.09.9-3.el7.x86_64 5/11
Verifying : python-IPy-0.75-6.el7.noarch 6/11
Verifying : audit-libs-python-2.8.5-4.el7.x86_64 7/11
Verifying : containerd.io-1.2.10-3.2.el7.x86_64 8/11
Verifying : 1:docker-ce-cli-19.03.5-3.el7.x86_64 9/11
Verifying : setools-libs-3.3.8-4.el7.x86_64 10/11
Verifying : libcgroup-0.41-21.el7.x86_64 11/11
Installed:
docker-ce.x86_64 3:18.09.9-3.el7
Dependency Installed:
audit-libs-python.x86_64 0:2.8.5-4.el7
checkpolicy.x86_64 0:2.5-8.el7
container-selinux.noarch 2:2.107-3.el7
containerd.io.x86_64 0:1.2.10-3.2.el7
docker-ce-cli.x86_64 1:19.03.5-3.el7
libcgroup.x86_64 0:0.41-21.el7
libsemanage-python.x86_64 0:2.5-14.el7
policycoreutils-python.x86_64 0:2.5-33.el7
python-IPy.noarch 0:0.75-6.el7
setools-libs.x86_64 0:3.3.8-4.el7
Complete!
[root@k8s-master ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@k8s-master ~]# systemctl start docker
[root@k8s-master ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-02-12 10:10:03 CST; 6s ago
Docs: https://docs.docker.com
Main PID: 1911 (dockerd)
Tasks: 12
Memory: 39.3M
CGroup: /system.slice/docker.service
└─1911 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/cont...
Feb 12 10:10:02 k8s-master dockerd[1911]: time="2020-02-12T10:10:02.34888797...c
Feb 12 10:10:02 k8s-master dockerd[1911]: time="2020-02-12T10:10:02.34901014...c
Feb 12 10:10:02 k8s-master dockerd[1911]: time="2020-02-12T10:10:02.76509531..."
Feb 12 10:10:02 k8s-master dockerd[1911]: time="2020-02-12T10:10:02.76605705..."
Feb 12 10:10:02 k8s-master dockerd[1911]: time="2020-02-12T10:10:02.99515744..."
Feb 12 10:10:03 k8s-master dockerd[1911]: time="2020-02-12T10:10:03.06445846..."
Feb 12 10:10:03 k8s-master dockerd[1911]: time="2020-02-12T10:10:03.10487518...9
Feb 12 10:10:03 k8s-master dockerd[1911]: time="2020-02-12T10:10:03.10503137..."
Feb 12 10:10:03 k8s-master dockerd[1911]: time="2020-02-12T10:10:03.11493511..."
Feb 12 10:10:03 k8s-master systemd[1]: Started Docker Application Container...e.
Hint: Some lines were ellipsized, use -l to show in full.
[root@k8s-master ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
[root@k8s-master ~]# sudo systemctl restart docker
[root@k8s-master ~]# cat > /etc/yum.repos.d/kubernetes.repo << EOF
> [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
> EOF
[root@k8s-master ~]# yum install -y kubelet-1.16.0 kubeadm-1.16.0 kubectl-1.16.0
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
kubernetes | 1.4 kB 00:00
kubernetes/primary | 63 kB 00:00
kubernetes 460/460
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.16.0-0 will be installed
--> Processing Dependency: kubernetes-cni >= 0.7.5 for package: kubeadm-1.16.0-0.x86_64
--> Processing Dependency: cri-tools >= 1.13.0 for package: kubeadm-1.16.0-0.x86_64
---> Package kubectl.x86_64 0:1.16.0-0 will be installed
---> Package kubelet.x86_64 0:1.16.0-0 will be installed
--> Processing Dependency: socat for package: kubelet-1.16.0-0.x86_64
--> Processing Dependency: conntrack for package: kubelet-1.16.0-0.x86_64
--> Running transaction check
---> Package conntrack-tools.x86_64 0:1.4.4-5.el7_7.2 will be installed
--> Processing Dependency: libnetfilter_cttimeout.so.1(LIBNETFILTER_CTTIMEOUT_1.1)(64bit) for package: conntrack-tools-1.4.4-5.el7_7.2.x86_64
--> Processing Dependency: libnetfilter_cttimeout.so.1(LIBNETFILTER_CTTIMEOUT_1.0)(64bit) for package: conntrack-tools-1.4.4-5.el7_7.2.x86_64
--> Processing Dependency: libnetfilter_cthelper.so.0(LIBNETFILTER_CTHELPER_1.0)(64bit) for package: conntrack-tools-1.4.4-5.el7_7.2.x86_64
--> Processing Dependency: libnetfilter_queue.so.1()(64bit) for package: conntrack-tools-1.4.4-5.el7_7.2.x86_64
--> Processing Dependency: libnetfilter_cttimeout.so.1()(64bit) for package: conntrack-tools-1.4.4-5.el7_7.2.x86_64
--> Processing Dependency: libnetfilter_cthelper.so.0()(64bit) for package: conntrack-tools-1.4.4-5.el7_7.2.x86_64
---> Package cri-tools.x86_64 0:1.13.0-0 will be installed
---> Package kubernetes-cni.x86_64 0:0.7.5-0 will be installed
---> Package socat.x86_64 0:1.7.3.2-2.el7 will be installed
--> Running transaction check
---> Package libnetfilter_cthelper.x86_64 0:1.0.0-10.el7_7.1 will be installed
---> Package libnetfilter_cttimeout.x86_64 0:1.0.0-6.el7_7.1 will be installed
---> Package libnetfilter_queue.x86_64 0:1.0.2-2.el7_2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
kubeadm x86_64 1.16.0-0 kubernetes 9.5 M
kubectl x86_64 1.16.0-0 kubernetes 10 M
kubelet x86_64 1.16.0-0 kubernetes 22 M
Installing for dependencies:
conntrack-tools x86_64 1.4.4-5.el7_7.2 updates 187 k
cri-tools x86_64 1.13.0-0 kubernetes 5.1 M
kubernetes-cni x86_64 0.7.5-0 kubernetes 10 M
libnetfilter_cthelper x86_64 1.0.0-10.el7_7.1 updates 18 k
libnetfilter_cttimeout x86_64 1.0.0-6.el7_7.1 updates 18 k
libnetfilter_queue x86_64 1.0.2-2.el7_2 base 23 k
socat x86_64 1.7.3.2-2.el7 base 290 k
Transaction Summary
================================================================================
Install 3 Packages (+7 Dependent packages)
Total download size: 57 M
Installed size: 262 M
Downloading packages:
(1/10): conntrack-tools-1.4.4-5.el7_7.2.x86_64.rpm | 187 kB 00:00
(2/10): 14bfe6e75a9efc8eca3f638eb22c7e2ce759c67f95b43b16fa | 5.1 MB 00:30
(3/10): be6a085d0285f83d74429540b878a137a9341ba34dbd85dfba | 10 MB 00:06
(4/10): 697ad1a31f01e90f44ad3f0c8fe06f32d7bdd3b227fcf70527 | 9.5 MB 00:43
(5/10): libnetfilter_cthelper-1.0.0-10.el7_7.1.x86_64.rpm | 18 kB 00:01
(6/10): libnetfilter_queue-1.0.2-2.el7_2.x86_64.rpm | 23 kB 00:01
(7/10): libnetfilter_cttimeout-1.0.0-6.el7_7.1.x86_64.rpm | 18 kB 00:01
(8/10): d58731a80db4214f3f1021f5676fe7f4da7239fc4a48c60f15 | 22 MB 00:11
(9/10): 548a0dcd865c16a50980420ddfa5fbccb8b59621179798e6dc | 10 MB 00:05
(10/10): socat-1.7.3.2-2.el7.x86_64.rpm | 290 kB 00:03
--------------------------------------------------------------------------------
Total 1.2 MB/s | 57 MB 00:49
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : socat-1.7.3.2-2.el7.x86_64 1/10
Installing : kubectl-1.16.0-0.x86_64 2/10
Installing : libnetfilter_cttimeout-1.0.0-6.el7_7.1.x86_64 3/10
Installing : cri-tools-1.13.0-0.x86_64 4/10
Installing : libnetfilter_queue-1.0.2-2.el7_2.x86_64 5/10
Installing : libnetfilter_cthelper-1.0.0-10.el7_7.1.x86_64 6/10
Installing : conntrack-tools-1.4.4-5.el7_7.2.x86_64 7/10
Installing : kubernetes-cni-0.7.5-0.x86_64 8/10
Installing : kubelet-1.16.0-0.x86_64 9/10
Installing : kubeadm-1.16.0-0.x86_64 10/10
Verifying : libnetfilter_cthelper-1.0.0-10.el7_7.1.x86_64 1/10
Verifying : conntrack-tools-1.4.4-5.el7_7.2.x86_64 2/10
Verifying : libnetfilter_queue-1.0.2-2.el7_2.x86_64 3/10
Verifying : kubelet-1.16.0-0.x86_64 4/10
Verifying : cri-tools-1.13.0-0.x86_64 5/10
Verifying : libnetfilter_cttimeout-1.0.0-6.el7_7.1.x86_64 6/10
Verifying : kubectl-1.16.0-0.x86_64 7/10
Verifying : kubernetes-cni-0.7.5-0.x86_64 8/10
Verifying : socat-1.7.3.2-2.el7.x86_64 9/10
Verifying : kubeadm-1.16.0-0.x86_64 10/10
Installed:
kubeadm.x86_64 0:1.16.0-0 kubectl.x86_64 0:1.16.0-0 kubelet.x86_64 0:1.16.0-0
Dependency Installed:
conntrack-tools.x86_64 0:1.4.4-5.el7_7.2
cri-tools.x86_64 0:1.13.0-0
kubernetes-cni.x86_64 0:0.7.5-0
libnetfilter_cthelper.x86_64 0:1.0.0-10.el7_7.1
libnetfilter_cttimeout.x86_64 0:1.0.0-6.el7_7.1
libnetfilter_queue.x86_64 0:1.0.2-2.el7_2
socat.x86_64 0:1.7.3.2-2.el7
Complete!
[root@k8s-master ~]# systemctl enable kubelet
Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /usr/lib/systemd/system/kubelet.service.
[root@k8s-master ~]# kubeadm init \
--apiserver-advertise-address=192.168.1.111 \
--image-repository registry.aliyuncs.com/google_containers \
--kubernetes-version v1.16.0 \
--service-cidr=10.1.0.0/16 \
--pod-network-cidr=10.244.0.0/16
[init] Using Kubernetes version: v1.16.0
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Activating the kubelet service
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [k8s-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.1.0.1 192.168.1.111]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.1.111 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.1.111 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[apiclient] All control plane components are healthy after 38.503417 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.16" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node k8s-master as control-plane by adding the label "node-role.kubernetes.io/master=''"
[mark-control-plane] Marking the node k8s-master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: 3a8akv.5sdpd199534o5knk
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.1.111:6443 --token 3a8akv.5sdpd199534o5knk \
--discovery-token-ca-cert-hash sha256:beb8860fe8f6fb4abaf23fa0570142fb6b81b2c3bf8a9a228bae884184c7035e
[root@k8s-master ~]# mkdir -p $HOME/.kube
[root@k8s-master ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@k8s-master ~]# sudo chown $(id -u):$(id -g) $HOME/.kube/config
[root@k8s-master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master NotReady master 101s v1.16.0
k8s-node1 NotReady
k8s-node2 NotReady
[root@k8s-master ~]# cd /usr/local/src/
[root@k8s-master src]# rz -y
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring dashboard.yaml...
100% 6 KB 6 KB/sec 00:00:01 0 Errors
Transferring kube-flannel.yaml...
100% 4 KB 4 KB/sec 00:00:01 0 Errors
[root@k8s-master src]# ls
dashboard.yaml kube-flannel.yaml
[root@k8s-master src]# kubectl apply -f kube-flannel.yaml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds-amd64 created
[root@k8s-master src]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-58cc8c89f4-7s2n9 0/1 Pending 0 2m50s
coredns-58cc8c89f4-h7d26 0/1 Pending 0 2m50s
etcd-k8s-master 1/1 Running 0 2m3s
kube-apiserver-k8s-master 1/1 Running 0 2m1s
kube-controller-manager-k8s-master 1/1 Running 0 113s
kube-flannel-ds-amd64-75824 0/1 Init:0/1 0 8s
kube-flannel-ds-amd64-7snx6 0/1 Init:0/1 0 8s
kube-flannel-ds-amd64-85vf8 0/1 Init:0/1 0 8s
kube-proxy-62g7k 1/1 Running 0 107s
kube-proxy-rlz5r 1/1 Running 0 103s
kube-proxy-tqrnv 1/1 Running 0 2m50s
kube-scheduler-k8s-master 1/1 Running 0 2m5s
等大概十分钟左右
[root@k8s-master src]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-58cc8c89f4-7s2n9 1/1 Running 0 5m24s
coredns-58cc8c89f4-h7d26 1/1 Running 0 5m24s
etcd-k8s-master 1/1 Running 0 4m37s
kube-apiserver-k8s-master 1/1 Running 0 4m35s
kube-controller-manager-k8s-master 1/1 Running 0 4m27s
kube-flannel-ds-amd64-75824 1/1 Running 0 2m42s
kube-flannel-ds-amd64-7snx6 1/1 Running 0 2m42s
kube-flannel-ds-amd64-85vf8 1/1 Running 0 2m42s
kube-proxy-62g7k 1/1 Running 0 4m21s
kube-proxy-rlz5r 1/1 Running 0 4m17s
kube-proxy-tqrnv 1/1 Running 0 5m24s
kube-scheduler-k8s-master 1/1 Running 0 4m39s
[root@k8s-master src]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 5m45s v1.16.0
k8s-node1 Ready
k8s-node2 Ready
[root@k8s-master src]# kubectl create deployment nginx --image=nginx
deployment.apps/nginx created
[root@k8s-master src]# kubectl expose deployment nginx --port=80 --type=NodePort
service/nginx exposed
[root@k8s-master src]# kubectl get pod,svc
NAME READY STATUS RESTARTS AGE
pod/nginx-86c57db685-wpkxv 0/1 ContainerCreating 0 15s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.1.0.1
service/nginx NodePort 10.1.131.49
访问地址:http://NodeIP:Port
192.168.1.112:32232
[root@k8s-master src]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 7m4s v1.16.0
k8s-node1 Ready
k8s-node2 Ready
[root@k8s-master src]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-58cc8c89f4-7s2n9 1/1 Running 0 6m48s
coredns-58cc8c89f4-h7d26 1/1 Running 0 6m48s
etcd-k8s-master 1/1 Running 0 6m1s
kube-apiserver-k8s-master 1/1 Running 0 5m59s
kube-controller-manager-k8s-master 1/1 Running 0 5m51s
kube-flannel-ds-amd64-75824 1/1 Running 0 4m6s
kube-flannel-ds-amd64-7snx6 1/1 Running 0 4m6s
kube-flannel-ds-amd64-85vf8 1/1 Running 0 4m6s
kube-proxy-62g7k 1/1 Running 0 5m45s
kube-proxy-rlz5r 1/1 Running 0 5m41s
kube-proxy-tqrnv 1/1 Running 0 6m48s
kube-scheduler-k8s-master 1/1 Running 0 6m3s
[root@k8s-master src]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 7m58s v1.16.0
k8s-node1 Ready
k8s-node2 Ready
[root@k8s-master src]# kubectl get pod,svc
NAME READY STATUS RESTARTS AGE
pod/nginx-86c57db685-wpkxv 1/1 Running 0 98s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.1.0.1
service/nginx NodePort 10.1.131.49
[root@k8s-master src]# ls
dashboard.yaml kube-flannel.yaml
[root@k8s-master src]# kubectl apply -f dashboard.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
[root@k8s-master src]# kubectl get pods -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
dashboard-metrics-scraper-566cddb686-jhhgm 1/1 Running 0 77s
kubernetes-dashboard-7b5bf5d559-b6n4d 1/1 Running 0 77s
[root@k8s-master src]# kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard
serviceaccount/dashboard-admin created
[root@k8s-master src]# kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin
clusterrolebinding.rbac.authorization.k8s.io/dashboard-admin created
[root@k8s-master src]# kubectl describe secrets -n kubernetes-dashboard $(kubectl -n kubernetes-dashboard get secret | awk '/dashboard-admin/{print $1}')
Name: dashboard-admin-token-llqd8
Namespace: kubernetes-dashboard
Labels:
Annotations: kubernetes.io/service-account.name: dashboard-admin
kubernetes.io/service-account.uid: a8609459-37ce-4b92-8ca7-faa439e4d886
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1025 bytes
namespace: 20 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IjlzWmE0ZzNJaEpVbzJrNFRSdGpiUlBsSTBpcVBzbzBmalFyOUtuSkJJQ0EifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tbGxxZDgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiYTg2MDk0NTktMzdjZS00YjkyLThjYTctZmFhNDM5ZTRkODg2Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmVybmV0ZXMtZGFzaGJvYXJkOmRhc2hib2FyZC1hZG1pbiJ9.OZyk7O4i_oT0NRZpKuztTDtMdZWE9fiQcix-F3Ea4Bbucw9L2kemmUiCI-jr6Z9IqjXv2i_0ZexIl8WgVHb2XJRlWY4bSdgZveWbokF1JqiVmEF8LyTwIT89eI6g39J3VCbMls7hLZ_Cq3zf5m8IAFWdhF2twIP2poCx9LczQ_YDaOJrkpLS-MOjVsksJZbM1gcTlRmHqy6ng2597mgsju-SlEJ8u1M3nBRyEVPIz3SbvAsOPGuoetPN-sZaep-TCcfuq6i85J0kpjekpIvMNrm-9jEgjmEY8FWVdkjBVcQqBjdChuD_xEwaKDjEncXEFq02WD5SGfxa_Q-vrAjF1g
必须要用火狐浏览器:
访问地址:http://NodeIP:30001
dashboard部署成功
k8s-node1和k8s-node2的部署步骤一样
[root@k8s-node2 ~]# getenforce
Disabled
[root@k8s-node2 ~]# cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
[root@k8s-node2 ~]# cat /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
[root@k8s-node2 ~]# sysctl --system
* Applying /usr/lib/sysctl.d/00-system.conf ...
* Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
kernel.yama.ptrace_scope = 0
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.d/k8s.conf ...
* Applying /etc/sysctl.conf ...
[root@k8s-node2 ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
--2020-02-12 10:07:18-- https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 119.96.207.104, 119.96.207.102, 119.96.207.101, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|119.96.207.104|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2640 (2.6K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/docker-ce.repo’
100%[======================================>] 2,640 --.-K/s in 0s
2020-02-12 10:07:18 (641 MB/s) - ‘/etc/yum.repos.d/docker-ce.repo’ saved [2640/2640]
[root@k8s-node2 ~]# yum list docker-ce --showduplicates | sort -r
* updates: mirrors.aliyun.com
Loaded plugins: fastestmirror
* extras: mirrors.aliyun.com
docker-ce.x86_64 3:19.03.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.0-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
Determining fastest mirrors
* base: mirrors.aliyun.com
Available Packages
[root@k8s-node2 ~]# yum -y install docker-ce-18.09.9-3.el7
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:18.09.9-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Processing Dependency: containerd.io >= 1.2.2-3 for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Processing Dependency: libcgroup for package: 3:docker-ce-18.09.9-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.107-3.el7 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.107-3.el7.noarch
---> Package containerd.io.x86_64 0:1.2.10-3.2.el7 will be installed
---> Package docker-ce-cli.x86_64 1:19.03.5-3.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-33.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-ce x86_64 3:18.09.9-3.el7 docker-ce-stable 21 M
Installing for dependencies:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
container-selinux noarch 2:2.107-3.el7 extras 39 k
containerd.io x86_64 1.2.10-3.2.el7 docker-ce-stable 23 M
docker-ce-cli x86_64 1:19.03.5-3.el7 docker-ce-stable 39 M
libcgroup x86_64 0.41-21.el7 base 66 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
policycoreutils-python x86_64 2.5-33.el7 base 457 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
Transaction Summary
================================================================================
Install 1 Package (+10 Dependent packages)
Total download size: 85 M
Installed size: 354 M
Downloading packages:
(1/11): container-selinux-2.107-3.el7.noarch.rpm | 39 kB 00:00
(2/11): audit-libs-python-2.8.5-4.el7.x86_64.rpm | 76 kB 00:00
(3/11): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for containerd.io-1.2.10-3.2.el7.x86_64.rpm is not installed
(4/11): containerd.io-1.2.10-3.2.el7.x86_64.rpm | 23 MB 00:31
(5/11): libcgroup-0.41-21.el7.x86_64.rpm | 66 kB 00:01
(6/11): libsemanage-python-2.5-14.el7.x86_64.rpm | 113 kB 00:01
(7/11): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00
(8/11): policycoreutils-python-2.5-33.el7.x86_64.rpm | 457 kB 00:01
(9/11): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:04
(10/11): docker-ce-18.09.9-3.el7.x86_64.rpm | 21 MB 00:41
(11/11): docker-ce-cli-19.03.5-3.el7.x86_64.rpm | 39 MB 00:39
--------------------------------------------------------------------------------
Total 1.2 MB/s | 85 MB 01:11
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm)
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libcgroup-0.41-21.el7.x86_64 1/11
Installing : setools-libs-3.3.8-4.el7.x86_64 2/11
Installing : 1:docker-ce-cli-19.03.5-3.el7.x86_64 3/11
Installing : audit-libs-python-2.8.5-4.el7.x86_64 4/11
Installing : python-IPy-0.75-6.el7.noarch 5/11
Installing : libsemanage-python-2.5-14.el7.x86_64 6/11
Installing : checkpolicy-2.5-8.el7.x86_64 7/11
Installing : policycoreutils-python-2.5-33.el7.x86_64 8/11
Installing : 2:container-selinux-2.107-3.el7.noarch 9/11
setsebool: SELinux is disabled.
Installing : containerd.io-1.2.10-3.2.el7.x86_64 10/11
Installing : 3:docker-ce-18.09.9-3.el7.x86_64 11/11
Verifying : checkpolicy-2.5-8.el7.x86_64 1/11
Verifying : policycoreutils-python-2.5-33.el7.x86_64 2/11
Verifying : libsemanage-python-2.5-14.el7.x86_64 3/11
Verifying : 2:container-selinux-2.107-3.el7.noarch 4/11
Verifying : 3:docker-ce-18.09.9-3.el7.x86_64 5/11
Verifying : python-IPy-0.75-6.el7.noarch 6/11
Verifying : audit-libs-python-2.8.5-4.el7.x86_64 7/11
Verifying : containerd.io-1.2.10-3.2.el7.x86_64 8/11
Verifying : 1:docker-ce-cli-19.03.5-3.el7.x86_64 9/11
Verifying : setools-libs-3.3.8-4.el7.x86_64 10/11
Verifying : libcgroup-0.41-21.el7.x86_64 11/11
Installed:
docker-ce.x86_64 3:18.09.9-3.el7
Dependency Installed:
audit-libs-python.x86_64 0:2.8.5-4.el7
checkpolicy.x86_64 0:2.5-8.el7
container-selinux.noarch 2:2.107-3.el7
containerd.io.x86_64 0:1.2.10-3.2.el7
docker-ce-cli.x86_64 1:19.03.5-3.el7
libcgroup.x86_64 0:0.41-21.el7
libsemanage-python.x86_64 0:2.5-14.el7
policycoreutils-python.x86_64 0:2.5-33.el7
python-IPy.noarch 0:0.75-6.el7
setools-libs.x86_64 0:3.3.8-4.el7
Complete!
[root@k8s-node2 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@k8s-node2 ~]# systemctl start docker
[root@k8s-node2 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-02-12 10:10:02 CST; 6s ago
Docs: https://docs.docker.com
Main PID: 1908 (dockerd)
Tasks: 14
Memory: 39.3M
CGroup: /system.slice/docker.service
网页标题:快速部署一个kubernetes集群
网页URL:http://ybzwz.com/article/jehhej.html