操作系统:CentOS7.6
内核版本:Linux 3.10.0-957.el7.x86_64
kubernetes:v1.13.5
docker版本:18.06.1-ce
你需要准备如下这些东西
https://github.com/rancher/rke/releases 这个链接,找你要的版本,本例为v0.2.1
https://rancher.com/docs/rke/latest/en/example-yamls/ 这里有cluster.yml文件的样例
IP | 角色 | 备注 |
---|---|---|
10.3.222.222 | rke部署机 | |
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 | node3 |
# setenforce 0
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# systemctl stop firewalld && systemctl disable firewalld
# yum install -y epel-release
# yum install -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 install -y docker-ce-18.06.1.ce
# useradd -g docker docker
将10.3.222.222主机root用户的公钥添加到k8s所有节点docker用户下的authorized_keys文件中。
# echo "your key" >> /home/docker/.ssh/authorized_keys
在10.3.222.222(rke部署机)上
下载rke
# wget https://github.com/rancher/rke/releases/download/v0.2.1/rke_linux-amd64
# chmod 777 rke_linux-amd64
# mv rke_linux-amd64 rke
nodes:
- address: 10.3.222.223
user: docker
role:
- controlplane
- etcd
labels:
ingress: 'true'
- address: 10.3.222.224
user: docker
role:
- controlplane
- etcd
labels:
ingress: 'true'
- address: 10.3.222.225
user: docker
role:
- controlplane
- etcd
labels:
ingress: 'true'
- address: 10.3.222.226
user: docker
role:
- worker
- address: 10.3.222.227
user: docker
role:
- worker
- address: 10.3.222.228
user: docker
role:
- worker
ingress:
provider: none
ignore_docker_version: true
cluster_name: k8s_test
services:
kube-api:
service_cluster_ip_range: 10.96.0.0/16
service_node_port_range: 30000-42767
pod_security_policy: false
kubelet:
cluster_domain: cluster.local
cluster_dns_server: 10.96.0.10
fail_swap_on: false
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
authentication:
strategy: x509
authorization:
mode: rbac
network:
plugin: flannel
addons_include:
- https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v1.11/nvidia-device-plugin.yml
本例中的cluster.yml文件提供一个样例,可以根据自己实际需要在文件中添加或删除一些参数。
将cluster.yml和下载的rke放到同一个目录
# ./rke up
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。