0%

Kubernetes 工作节点安装

一、配置环境

/etc/sysctl.d/xxx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
net.ipv4.ip_forward = 1
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120

net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_announce=2


net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
kernel.sysrq = 1

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1

注,必须是单个ETH IP地址,否则会安装不成功。

配置Kubernetes RPM源,安装kuberet / kubeadm / kubectl

创建/etc/yum.repos.d/kubernetes.repo文件:

1
2
3
4
5
6
7
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

安装相关应用 kuberet / kubeadm / kubectl

1
2
$ yum install -y kubelet kubeadm kubectl
$ systemctl enable kubelet && systemctl start kubelet

二、接入

1
2
kubeadm join 192.168.55.55:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:04f7a66c3f1775c0bc12ae875b164d9b121b93fe02ee004bd3b978c5facd3538