一、环境准备
1、三台8核/16G内存/500G高速硬盘服务器和三台16核/32G内存/500G高速硬盘服务器
2、CentOS 7
3、关闭selinux和关闭防火墙
4、升级系统内核(参考:https://www.cnblogs.com/a120608yby/p/10169364.html)
二、配置免密登录
1 2 3 4 5 | # 创建密钥对 ssh -keygen 复制密钥到所有节点包括自身 ssh -copy- id 所有节点的IP地址 |
三、部署
1、下载源码、二进制文件或离线镜像
1 2 3 | export release=3.5.2 wget https: //github .com /easzlab/kubeasz/releases/download/ ${release} /ezdown chmod +x . /ezdown |
2、下载kubeasz代码、二进制、默认容器镜像
1 2 3 4 5 | # 国内环境 . /ezdown -D # 海外环境 . /ezdown -D -m standard |
3、创建集群
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | # 容器化运行kubeasz . /ezdown -S # 创建新集群 k8s-01 docker exec -it kubeasz ezctl new k8s-01 # 配置/etc/kubeasz/clusters/k8s-01/hosts和/etc/kubeasz/clusters/k8s-01/config.yml # vim hosts # 'etcd' cluster should have odd member(s) (1,3,5,...) [etcd] 172.16.0.1 172.16.0.2 172.16.0.3 # master node(s), set unique 'k8s_nodename' for each node # CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', # and must start and end with an alphanumeric character [kube_master] 172.16.0.1 k8s_nodename= 'master-01' 172.16.0.2 k8s_nodename= 'master-02' 172.16.0.3 k8s_nodename= 'master-03' # work node(s), set unique 'k8s_nodename' for each node # CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', # and must start and end with an alphanumeric character [kube_node] 172.16.0.4 k8s_nodename= 'worker-01' 172.16.0.5 k8s_nodename= 'worker-02' 172.16.0.6 k8s_nodename= 'worker-03' # [optional] harbor server, a private docker registry # 'NEW_INSTALL': 'true' to install a harbor server; 'false' to integrate with existed one [harbor] #192.168.1.8 NEW_INSTALL=false # [optional] loadbalance for accessing k8s from outside [ex_lb] #192.168.1.6 LB_ROLE=backup EX_APISERVER_VIP=192.168.1.250 EX_APISERVER_PORT=8443 #192.168.1.7 LB_ROLE=master EX_APISERVER_VIP=192.168.1.250 EX_APISERVER_PORT=8443 # [optional] ntp server for the cluster [chrony] #192.168.1.1 [all:vars] # --------- Main Variables --------------- # Secure port for apiservers SECURE_PORT= "6443" # Cluster container-runtime supported: docker, containerd # if k8s version >= 1.24, docker is not supported CONTAINER_RUNTIME= "containerd" # Network plugins supported: calico, flannel, kube-router, cilium, kube-ovn CLUSTER_NETWORK= "calico" # Service proxy mode of kube-proxy: 'iptables' or 'ipvs' PROXY_MODE= "ipvs" # K8S Service CIDR, not overlap with node(host) networking SERVICE_CIDR= "10.68.0.0/16" # Cluster CIDR (Pod CIDR), not overlap with node(host) networking CLUSTER_CIDR= "10.20.0.0/16" # NodePort Range NODE_PORT_RANGE= "30000-32767" # Cluster DNS Domain CLUSTER_DNS_DOMAIN= "cluster.local" # -------- Additional Variables (don't change the default value right now) --- # Binaries Directory bin_dir= "/opt/kube/bin" # Deploy Directory (kubeasz workspace) base_dir= "/etc/kubeasz" # Directory for a specific cluster cluster_dir= "{{ base_dir }}/clusters/k8s-01" # CA and other components cert/key Directory ca_dir= "/etc/kubernetes/ssl" # Default 'k8s_nodename' is empty k8s_nodename= '' |
4、安装集群
1 2 | # 一键安装 docker exec -it kubeasz ezctl setup k8s-01 all |
参考:
1 | https: //github .com /easzlab/kubeasz |
分类:
Kubernetes
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix