操作系統(tǒng):CentOS7.6
內(nèi)核版本:Linux 3.10.0-957.el7.x86_64
kubernetes:v1.13.5
docker版本:18.06.1-ce
你需要準(zhǔn)備如下這些東西
https://github.com/rancher/rke/releases 這個(gè)鏈接,找你要的版本,本例為v0.2.1
https://rancher.com/docs/rke/latest/en/example-yamls/ 這里有cluster.yml文件的樣例
IP | 角色 | 備注 |
---|---|---|
10.3.222.222 | rke部署機(jī) | |
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主機(jī)root用戶的公鑰添加到k8s所有節(jié)點(diǎn)docker用戶下的authorized_keys文件中。
# echo "your key" >> /home/docker/.ssh/authorized_keys
在10.3.222.222(rke部署機(jī))上
下載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文件提供一個(gè)樣例,可以根據(jù)自己實(shí)際需要在文件中添加或刪除一些參數(shù)。
將cluster.yml和下載的rke放到同一個(gè)目錄
# ./rke up
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。