本文主要說明kubernetes集羣使用組建的版本和功能介紹。、html
1、組件版本node
2、主要配置策略linux
kube-apiserver:git
kube-controller-manager:github
kube-scheduler:docker
kubelet:json
kube-proxy:bootstrap
集羣插件:api
3、系統初始化安全
一、主機名修改 vi /etc/hostname
二、本地hosts解析
[root@k8s-master1 ssl]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.80.4 etcd1 192.168.80.5 etcd2 192.168.80.6 etcd3 192.168.80.7 k8s-master1 192.168.80.8 k8s-master2 192.168.80.9 k8s-master3 192.168.80.10 k8s-node1 192.168.80.11 k8s-node2 192.168.80.12 k8s-node3
三、無密碼ssh登錄其餘節點,(k8s-master1上生成密鑰)
[root@k8s-master1 ssl]# ssh-keygen -t rsa [root@k8s-master1 ssl]# ssh-copy-id etcd1 [root@k8s-master1 ssl]# ssh-copy-id etcd2 [root@k8s-master1 ssl]# ssh-copy-id etcd3 [root@k8s-master1 ssl]# ssh-copy-id k8s-master1 [root@k8s-master1 ssl]# ssh-copy-id k8s-master2 [root@k8s-master1 ssl]# ssh-copy-id k8s-master3 [root@k8s-master1 ssl]# ssh-copy-id k8s-node1 [root@k8s-master1 ssl]# ssh-copy-id k8s-node2 [root@k8s-master1 ssl]# ssh-copy-id k8s-node3
四、關閉防火牆
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo iptables -P FORWARD ACCEPT
五、關閉swap分區
sudo swapoff -a sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
六、關閉SELinux
sudo setenforce 0 grep SELINUX /etc/selinux/config SELINUX=disabled
七、加載內核模塊
sudo modprobe br_netfilter sudo modprobe ip_vs
八、設置系統參數
cat > kubernetes.conf <<EOF net.bridge.bridge-nf-call-iptables=1 net.bridge.bridge-nf-call-ip6tables=1 net.ipv4.ip_forward=1 net.ipv4.tcp_tw_recycle=0 vm.swappiness=0 vm.overcommit_memory=1 vm.panic_on_oom=0 fs.inotify.max_user_watches=89100 fs.file-max=52706963 fs.nr_open=52706963 net.ipv6.conf.all.disable_ipv6=1 net.netfilter.nf_conntrack_max=2310720
sysctl -p /etc/sysctl.d/kubernetes.conf
九、檢查系統內核和模塊適不適合運行docker(Linux系統)
curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh $ bash ./check-config.sh
4、環境介紹
ca-key.pem
ca.pem
flanneld-key.pem
flanneld.pem
kubelet-bootstrap.kubeconfig
kubelet-client-2018-12-20-20-10-59.pem
kubelet-client-current.pem
kubelet.config.json
kubelet.crt
kubelet.key
kubelet.kubeconfig
kube-proxy.config.yaml
kube-proxy.kubeconfig
主機名 | IP | 須要的證書(/etc/kubernetes/cert) | 運行的服務 |
etcd1 | 192.168.80.4 | ca-key.pem etcd-key.pem ca.pem etcd.pem |
etcd集羣 |
etcd2 | 192.168.80.5 | ||
etcd3 | 192.168.80.6 | ||
k8s-master1 | 192.168.80.7 | ca-key.pem ca.pem ca-config.json(←只生成證書的主機須要) encryption-config.yaml flanneld-key.pem flanneld.pem kube-controller-manager-key.pem kube-controller-manager.kubeconfig kube-controller-manager.pem kubernetes-key.pem kubernetes.pem kube-scheduler.kubeconfig ~/.kube/config |
kube-apiserver flanneld |
k8s-master2 | 192.168.80.8 | ||
k8s-master3 | 192.168.80.9 | ||
k8s-node1 | 192.168.80.10 | ca-key.pem |
docker flannel kubelet kube-proxy |
k8s-node2 | 192.168.80.11 | ||
k8s-node3 | 192.168.80.12 | ||
cluster VIP | 114.67.81.105 | 高可用VIP,負責調度apiserver 6443端口 |
下一篇咱們正式開始搭建kubernetes集羣所須要的組件,請參考:二進制搭建kubernetes多master集羣【1、使用TLS證書搭建etcd集羣】