首页 > 其他分享 >K8S and Rancher安装

K8S and Rancher安装

时间:2022-10-14 10:33:15浏览次数:48  
标签:rke2 set -- com kubeconfig rancher Rancher K8S 安装

========节点1=====================
==========安装docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io

sudo systemctl start docker
sudo docker run hello-world

=========安装Rancher
mkdir -p /etc/rancher/rke2 ##创建目录
vim /etc/rancher/rke2/config.yaml ##编辑配置文件

token: rke2-create-token ##自定义token
tls-san: 175.24.254.23 ##tls-san参数
system-default-registry: "registry.cn-hangzhou.aliyuncs.com" ##阿里云镜像库地址

curl -sfL https://get.rke2.io | sh -
systemctl start rke2-server.service && systemctl enable rke2-server.service

 

ln -s /var/lib/rancher/rke2/bin/kubectl /usr/bin/kubectl
ln -s /var/lib/rancher/rke2/bin/crictl /usr/bin/crictl

kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get node


===========节点2
==========安装docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io

sudo systemctl start docker
sudo docker run hello-world

=========安装Rancher
mkdir -p /etc/rancher/rke2 ##创建目录
vim /etc/rancher/rke2/config.yaml ##编辑配置文件

server: https://172.17.0.4:9345 ##第一个节点地址
token: K10c2e42f9f1c7a4c3fbb704bd2b00eecba2bc5969a944c510258f4c4f138523c1a::server:rke2-create-token ##在第一个节点上执行 cat /var/lib/rancher/rke2/server/token
tls-san: 172.17.0.4
system-default-registry: "registry.cn-hangzhou.aliyuncs.com"

curl -sfL https://get.rke2.io | sh -
systemctl start rke2-server.service && systemctl enable rke2-server.service


===========节点3
==========安装docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io

sudo systemctl start docker
sudo docker run hello-world

=========安装Rancher
mkdir -p /etc/rancher/rke2 ##创建目录
vim /etc/rancher/rke2/config.yaml ##编辑配置文件

server: https://172.17.0.4:9345 ##第一个节点地址
token: K10c2e42f9f1c7a4c3fbb704bd2b00eecba2bc5969a944c510258f4c4f138523c1a::server:rke2-create-token ##在第一个节点上执行 cat /var/lib/rancher/rke2/server/token
tls-san: 172.17.0.4
system-default-registry: "registry.cn-hangzhou.aliyuncs.com"

curl -sfL https://get.rke2.io | sh -
systemctl start rke2-server.service && systemctl enable rke2-server.service

=============节点1上检查


==========节点1 安装rancher=======
安装helm
wget https://mirrors.huaweicloud.com/helm/v3.10.0/helm-v3.10.0-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
helm repo add rancher-latest http://rancher-mirror.oss-cn-beijing.aliyuncs.com/server-charts/latest


创建ns
kubeconfig=/etc/rancher/rke2/rke2.yaml
kubectl --kubeconfig=$kubeconfig create namespace cattle-system


kubeconfig=/etc/rancher/rke2/rke2.yaml


kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml

kubectl --kubeconfig=$kubeconfig apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml

helm repo add jetstack https://charts.jetstack.io
helm repo update

# 安装 cert-manager Helm Chart
helm --kubeconfig=$kubeconfig install cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.7.1

kubectl --kubeconfig=$kubeconfig get pods --namespace cert-manager


kubeconfig=/etc/rancher/rke2/rke2.yaml

helm --kubeconfig=$kubeconfig install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=playground.aicoder.tech \
--set bootstrapPassword=admin \
--set rancherImage=registry.cn-hangzhou.aliyuncs.com/rancher/rancher \
--set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com \
--set rancherImageTag=v2.6.8


helm --kubeconfig=$kubeconfig upgrade rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=playground.aicoder.tech \
--set bootstrapPassword=admin \
--set rancherImage=registry.cn-hangzhou.aliyuncs.com/rancher/rancher \
--set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com \
--set rancherImageTag=v2.6.8


kubeconfig=/etc/rancher/rke2/rke2.yaml
kubectl --kubeconfig=$kubeconfig -n cattle-system rollout status deploy/rancher

kubeconfig=/etc/rancher/rke2/rke2.yaml
echo https://playground.aicoder.tech/dashboard/?setup=$(kubectl --kubeconfig=$kubeconfig get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}')

helm --kubeconfig=$kubeconfig upgrade rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=playground.aicoder.tech \
--set bootstrapPassword=admin \
--set rancherImage=registry.cn-hangzhou.aliyuncs.com/rancher/rancher \
--set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com \
--set rancherImageTag=v2.6.8

echo https://playground.aicoder.tech/dashboard/?setup=$(kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}')

密码:~@mt

1.15.23.54

标签:rke2,set,--,com,kubeconfig,rancher,Rancher,K8S,安装
From: https://www.cnblogs.com/littlesuccess/p/16790812.html

相关文章

  • Windows 安装 MySQL 5.7 x64 位
    下载地址:https://downloads.mysql.com/archives/installer/安装网站上只有x86没有x64位,之前下了x64的zip包,配置比较麻烦,其实这个x86包里面,已经包含了x64的包......
  • VMware虚拟机安装Android系统(转)
    一、首先我们先要准备好虚拟机和android系统安装包1、VMware下载:https://www.vmware.com/go/getworkstation-win激活码:ZF3R0-FHED2-M80TY-8QYGC-NPKYF2、Android系统下......
  • k8s指令
    k8s指令部署各个常用功能k8s之所以这么火,主要是提供了许多功能,比如服务的快速部署、服务的滚动升级、自动扩缩容、service下的服务负载均衡等功能。下面来动手实操下几个......
  • centos7 中manta软件的安装
     001、系统(base)[root@pc1~]#cat/etc/redhat-releaseCentOSLinuxrelease7.6.1810(Core) 002、下载安装包wgethttps://github.com/Illumina/manta/arc......
  • Redis labs 的安装
    Installandsetup ThisguideshowshowtoinstallRedisEnterpriseSoftware,whichincludesseveralsteps:PlanyourdeploymentDownloadthe installation......
  • 【云原生】Elasticsearch + kibana on k8s 讲解与实战操作
    目录一、概述二、Elasticsearch编排部署1)添加源并下载编排部署包2)构建镜像3)修改yaml编排4)开始部署5)测试验证6)elasticsearch-head7)卸载三、Kibana编排部署1)添加源并下载编......
  • maven下载、安装,创建
    1,maven准备:需要安装JDK并配置好环境变量下载地址:https://maven.apache.org/download.cgi2,下载完成之后解压到当前文件夹:D:\apache-maven-3.8.6 3,配置Maven环境变量......
  • JDK安装
    安装搜索JDK8版本,注册Oracle账户,查看自己电脑属性,接受协议,下载适用版本更改安装路径,默认为C盘,可以放到其他盘,新建一个好记的文件夹(新的文件夹名称不可带汉字,否则会安......
  • IIS 安装配置全攻略
    WEB篇Windows2000Server、Windows2000AdvancedServer以及Windows2000Professional的默认安装都带有IIS,也可以在Windows2000安装完毕后加装IIS。IIS......
  • 编译安装hls协议切片工具 m3u8-segmenter
    操作系统:Ubuntu16.04.4amd64安装​​http://m3u8-segmenter.inodes.org/​​方式安装m3u8-segmenter报错,于是有了这篇文章aptinstallaptitudeapt-add-repositoryppa:joh......