一、基础环境
操作系统:CentOS7.6
内核版本:Linux 3.10.0-957.el7.x86_64
kubernetes: v1.13.5
码头工人版本:18.06.1-ce
二,准备工作
你需要准备如下这些东西
1驾驶台安装包
https://github.com/rancher/rke/releases这个链接,找你要的版本,本例为v0.2.1
2 cluster.yml文件
https://rancher.com/docs/rke/latest/en/example-yamls/这里有cluster.yml文件的样例
3主机分配
知识产权 角色 备注 10.3.222.222 驾驶台部署机 10.3.222.223 master1 10.3.222.224 master2 10.3.222.225 node3 10.3.222.226 node1 10.3.222.227 node2 10.3.222.224 node34关闭所有主机的selinux, firewalld
0
# # setenforce sed - i ' s/SELINUX=执行/SELINUX=禁用//etc/selinux/config
# systemctl停止firewalld,,systemctl禁用firewalld
三、部署过程
1安装码头工人
# yum安装- y epel-release
# yum安装- y yum-utils net-tools conntrack-tools wget
# yum-config-manager \
——add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# yum安装- y docker-ce-18.06.1.ce
2添加用户
# useradd - g码头工人码头工人
3免密登录
将10.3.222.222主机根用户的公钥添加到k8所有节点码头工人用户下的authorized_keys文件中。
#回声“key"在比;/home/docker/.ssh/authorized_keys
4驾驶台操作
在10.3.222.222(驾驶台部署机)上
下载驾驶台
# wget https://github.com/rancher/rke/releases/download/v0.2.1/rke_linux-amd64
# chmod 777 rke_linux-amd64
# mv rke_linux-amd64驾驶台
5 cluster.yml文件
<代码类=" language-yaml ">节点: ——地址:10.3.222.223 用户:码头工人 角色: ——controlplane ——etcd 标签: 入口:“真正的” ——地址:10.3.222.224 用户:码头工人 角色: ——controlplane ——etcd 标签: 入口:“真正的” ——地址:10.3.222.225 用户:码头工人 角色: ——controlplane ——etcd 标签: 入口:“真正的” ——地址:10.3.222.226 用户:码头工人 角色: ——工人 ——地址:10.3.222.227 用户:码头工人 角色: ——工人 ——地址:10.3.222.228 用户:码头工人 角色: ——工人 入口: 提供者:没有 ignore_docker_version:真 cluster_name: k8s_test 服务: kube-api: service_cluster_ip_range: 10.96.0.0/16 service_node_port_range: 30000 - 42767 pod_security_policy:假 kubelet: cluster_domain: cluster.local cluster_dns_server: 10.96.0.10 fail_swap_on:假 extra_args: max-pods: 250 cgroup-driver: cgroupfs kube-controller: cluster_cidr: 10.244.0.0/16 service_cluster_ip_range: 10.96.0.0/16 身份验证: 策略:x509 授权: rbac模式: 网络: 插件:法兰绒 addons_include: ——https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v1.11/nvidia-device-plugin.yml 代码>
本例中的cluster.yml文件提供一个样例,可以根据自己实际需要在文件中添加或删除一些参数。
6安装集群
将集群。yml和下载的驾驶台放到同一个目录