所有节点
| cat /etc/hosts |
| 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 |
| ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 |
| 192.168.1.161 test-k8s-master1 |
| 192.168.1.162 test-k8s-master2 |
| 192.168.1.163 test-k8s-master3 |
| |
| systemctl stop firewalld |
| systemctl disable firewalld |
| setenforce 0 |
| cat > /etc/sysconfig/modules/ipvs.modules <<EOF |
| #!/bin/bash |
| modprobe -- ip_vs |
| modprobe -- ip_vs_rr |
| modprobe -- ip_vs_wrr |
| modprobe -- ip_vs_sh |
| modprobe -- nf_conntrack_ipv4 |
| EOF |
| chmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack_ipv4 |
| cd /etc/yum.repos.d/ |
| wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo |
| cat >kubernetes.repo<<EOF |
| [kubernetes] |
| name=Kubernetes Repo |
| baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ |
| gpgcheck=1 |
| gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg |
| enable=1 |
| EOF |
| wget https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg |
| rpm --import yum-key.gpg |
| wget https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg |
| rpm --import rpm-package-key.gpg |
| echo -e "net.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables = 1\nnet.ipv4.ip_forward = 1" >>/etc/sysctl.conf |
| sysctl -p |
| |
| grep CONFIG_BRIDGE_NETFILTER /boot/config-`uname -r` |
| |
| yum install -y ntpdate docker-ce-18.09.9-3.el7 kubelet-1.20.15 kubectl-1.20.15 kubeadm-1.20.15 |
master节点
| |
| [root@test-k8s-master1 ~] |
| |
| [root@test-k8s-master1 ~] |
| apiVersion: kubeadm.k8s.io/v1beta2 |
| bootstrapTokens: |
| - groups: |
| - system:bootstrappers:kubeadm:default-node-token |
| token: abcdef.0123456789abcdef |
| ttl: 24h0m0s |
| usages: |
| - signing |
| - authentication |
| kind: InitConfiguration |
| localAPIEndpoint: |
| advertiseAddress: 192.168.1.161 |
| bindPort: 6443 |
| nodeRegistration: |
| criSocket: /var/run/dockershim.sock |
| name: test-k8s-master1 |
| taints: |
| - effect: NoSchedule |
| key: node-role.kubernetes.io/master |
| --- |
| apiServer: |
| timeoutForControlPlane: 4m0s |
| apiVersion: kubeadm.k8s.io/v1beta2 |
| certificatesDir: /etc/kubernetes/pki |
| clusterName: kubernetes |
| controlPlaneEndpoint: 192.168.1.133:6443 |
| controllerManager: {} |
| dns: |
| type: CoreDNS |
| etcd: |
| local: |
| dataDir: /var/lib/etcd |
| imageRepository: registry.aliyuncs.com/google_containers |
| kind: ClusterConfiguration |
| kubernetesVersion: v1.20.15 |
| networking: |
| dnsDomain: cluster.local |
| serviceSubnet: 10.96.0.0/12 |
| podSubnet: 10.244.0.0/16 |
| scheduler: {} |
| --- |
| apiVersion: kubelet.config.k8s.io/v1beta1 |
| kind: KubeletConfiguration |
| cgroupDriver: systemd |
| |
| [root@test-k8s-master1 ~] |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!