\nCentos7<\/td>\n | 64.115.5.222<\/td>\n | K8s-node4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n1.\u521d\u59cb\u5316\u670d\u52a1\u5668<\/h2>\n\u200b \u5bf9\u65b0\u589e\u7684\u670d\u52a1\u5668\u8fdb\u884c\u521d\u59cb\u5316\u64cd\u4f5c,\u7b80\u5355\u5199\u4e86\u4e2a\u811a\u672c\uff0c\u811a\u672c\u5185\u5bb9\u5982\u4e0b,\u90e8\u5206\u53c2\u6570\u9700\u6839\u636e\u81ea\u5df1\u73af\u5883\u8fdb\u884c\u4fee\u6539\u3002<\/strong><\/p>\n#!\/bin\/bash\nset -x \n#k8s\u96c6\u7fa4\u5b89\u88c5\u670d\u52a1\u5668\u521d\u59cb\u5316\u811a\u672c\n\n#\u5b89\u88c5\u4f9d\u8d56\u5305\nyum install -y conntrack ntpdate ntp ipvsadm ipset jq iptables curl sysstat libseccomp wgetvimnet-tools git\n#\u8bbe\u7f6e\u9632\u706b\u5899\u4e3a Iptables \u5e76\u8bbe\u7f6e\u7a7a\u89c4\u5219\nsystemctl stop firewalld && systemctl disable firewalld\nyum -y install iptables-services && systemctl start iptables && systemctl enable iptables&& iptables -F && service iptables save\n#\u5173\u95ed SELINUX\nswapoff -a && sed -i '\/ swap \/ s\/^\\(.*\\)$\/#\\1\/g' \/etc\/fstab && setenforce 0 && sed -i 's\/^SELINUX=enforcing\/SELINUX=disabled\/' \/etc\/selinux\/config\n#\u540c\u6b65\u65f6\u95f4\nntpdate ntp3.aliyun.com\n#\u8c03\u6574\u7cfb\u7edf\u65f6\u533a\n#\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u533a\u4e3a\u4e2d\u56fd\/\u4e0a\u6d77\ntimedatectl set-timezone Asia\/Shanghai\n#\u5c06\u5f53\u524d\u7684 UTC \u65f6\u95f4\u5199\u5165\u786c\u4ef6\u65f6\u949f\ntimedatectl set-local-rtc 0\n#\u91cd\u542f\u4f9d\u8d56\u4e8e\u7cfb\u7edf\u65f6\u95f4\u7684\u670d\u52a1\nsystemctl restart rsyslog\nsystemctl restart crond\n#\u914d\u7f6e\u57df\u540d\u89e3\u6790\ncat >> EOF > \/etc\/hosts \n127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n64.115.4.23 k8s-master\n64.115.5.100 k8s-node1\n64.115.5.200 k8s-node2\n64.115.5.111 k8s-node3\n64.115.5.222 k8s-node4\nEOF\n#\u4fee\u6539\u4e3b\u673a\u540d\nhostnamectl set-hostname k8s-node3\n# docker\u963f\u91cc\u4e91\u6e90\ncurl -o \/etc\/yum.repos.d\/docker-ce.repo https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo\n\n### Install required packages for docker.\nyum install -y device-mapper-persistent-data lvm2\nyum install -y docker-ce-19.03.8\n\n## Create \/etc\/docker directory.\nmkdir \/etc\/docker\n\n# Setup daemon.\n```bash\ncat > \/etc\/docker\/daemon.json <<EOF\n{\n "registry-mirrors": ["https:\/\/lqetgo1f.mirror.aliyuncs.com","https:\/\/docker.mirrors.ustc.edu.cn\/"]\n}\nEOF\n```\nmkdir -p \/etc\/systemd\/system\/docker.service.d\n\n# Restart Docker\nsystemctl daemon-reload\nsystemctl restart docker\nsystemctl enable docker\n\n#\u91cd\u542f\u670d\u52a1\u5668\nreboot<\/code><\/pre>\n\n- \u91cd\u542f\u540e\u914d\u7f6e<\/li>\n<\/ul>\n
#\u521b\u5efa rke \u7528\u6237\n#useradd rke \n#\u5c06rke\u7528\u6237\u52a0\u5165docker\u7ec4\n#usermod -aG docker rke\n#\u514d\u5bc6\u767b\u5f55(\u4ee5\u4e0bmaster\u4e3b\u673a\u64cd\u4f5c)\n#su rke\n#sh-keygen -t rsa\n#ssh-copy-id -i \/home\/rke\/.ssh\/id_rsa.pub rke@k8s-master\n#ssh-copy-id -i \/home\/rke\/.ssh\/id_rsa.pub rke@k8s-node1\n#ssh-copy-id -i \/home\/rke\/.ssh\/id_rsa.pub rke@k8s-node2\n#ssh-copy-id -i \/home\/rke\/.ssh\/id_rsa.pub rke@k8s-node3\n#ssh-copy-id -i \/home\/rke\/.ssh\/id_rsa.pub rke@k8s-node4<\/code><\/pre>\n
|