使用rke快速安装K8s集群

操作系统

centos 7.5 

yum update -y

yum install docker -y

关闭防火墙、selinux

下载rke helm 

https://github.com/helm/helm/releases

 

helm init --client-only --stable-repo-url https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
helm repo add incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/
helm repo update

RKE安装

https://github.com/rancher/rke

下载二进制包

编辑yml文件https://rancher.com/docs/rancher/v2.x/en/installation/ha/kubernetes-rke/,注意缩进

[root@rancher-m-82-106-14 home]# cat rancher-cluster.yml
nodes:
- address: 10.82.106.14
user: rancher
role: [controlplane,worker,etcd]
ssh_key_path: ~/.ssh/id_rsa
- address: 10.82.106.18
user: rancher
role: [controlplane,worker,etcd]
ssh_key_path: ~/.ssh/id_rsa
- address: 10.82.106.19
user: rancher
role: [controlplane,worker,etcd]
ssh_key_path: ~/.ssh/id_rsa

services:
etcd:
snapshot: true
creation: 6h
retention: 24h

注意,要增加一个普通用户

 useradd rancher
 passwd rancher
 usermod -aG dockerroot rancher
 service docker restart
 chmod a+rw /var/run/docker.sock

免密登录。
 ssh-copy-id rancher@10.82.106.14
ssh 10.82.106.18
 ssh-copy-id rancher@10.82.106.18
 ssh-copy-id rancher@10.82.106.19
 ssh rancher@10.82.106.19

注意YML文件中的用户指建立的用户

./rke0.2.0 up --config ./rancher-cluster.yml

运行后:

把kube_config_rancher-cluster.yml文件复制为

~/.kube/config

测试kubctl version 

增加YUM库

[root@rancher-m-82-106-14 yum.repos.d]# cat kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

 

yum -y install kubelet kubeadm kubectl

 

posted on   net2817  阅读(3011)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示