当前位置: 首页 > news >正文

基于rancher安装部署k8s

基础配置

systemctl stop firewalld && systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/configvi /etc/hosts
ip1 node1
ip2 node2
ip3 node3#免密登录
ssh-keygenssh-copy-id -i ~/.ssh/id_rsa.pub 普通用户@ip1
ssh-copy-id -i ~/.ssh/id_rsa.pub 普通用户@ip2
ssh-copy-id -i ~/.ssh/id_rsa.pub 普通用户@ip3
#验证
ssh 普通用户@ip1

rancher

kubectl

yum install -y epel-release
yum -y install snapdsnap install kubectl --classic
kubectl help

rke

二进制安装文件,创建k8s集群

wget https://github.com/rancher/rke/releases/download/v1.3.20/rke_linux-amd64
cp rke_linux-amd64 /usr/local/bin/rke
chmod +x /usr/local/bin/rkerke --version

helm

k8s的包管理器,charts与helm的关系类似于rpm与yum。

wget https://get.helm.sh/helm-v3.12.0-linux-amd64.tar.gz
tar zxvf helm-v3.12.0-linux-amd64.tar.gz
cp linux-amd64/helm /usr/local/bin/helmhelm help

docker-ce

yum list docker-ce --showduplicates
yum install -y docker-ce-18.06.3.ce-3.el7

部署k8s

#vi rancher-cluster.yml
nodes:- address: ip1user: 普通用户role: [controlplane,worker,etcd] #节点角色- address: ip2user: 普通用户role: [controlplane,worker,etcd]- address: ip3user: 普通用户role: [controlplane,worker,etcd]services:etcd:snapshot: truecreation: 6hretention: 12
rke up --config ./rancher-cluster.yml
#返回下面的消息则说明执行成功:Finished building Kubernetes cluster successfully.
#kubectl get pods --all-namespaces,pod为running

保存以下文件:
rancher-cluster.yml:rke孵化k8s集群的配置文件
kube_config_rancher-cluster.yml:k8s被访问的kubeconfig文件,此文件包含完全访问群集的凭据
rancher-cluster.rkestate:k8s群集的状态文件,此文件包含完全访问群集的凭据

mkdir .kube
cp kube_config_rancher-cluster.yml .kube/
export KUBECONFIG=$(pwd)/kube_config_rancher-cluster.yml
#查看
kubectl get nodes

部署rancher

#加仓库
helm repo add rancher-stable https://releases.rancher.com/server-charts/stablekubectl create namespace cattle-system#安装CustomResourceDefinition资源
kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.12/deploy/manifests/00-crds.yamlkubectl create namespace cert-manager
#添加Jetstack仓库,更新缓存
helm repo add jetstack https://charts.jetstack.io
helm repo update#通过helm chart安装cert-manager
helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v0.12.0#验证
kubectl get pods --namespace cert-manager
http://www.lryc.cn/news/191093.html

相关文章:

  • 保姆级微服务部署教程
  • springboot 定时任务
  • 【大数据】HBase入门指南
  • 零售数据分析模板鉴赏-品类销售结构报表
  • 竞赛 深度学习 机器视觉 车位识别车道线检测 - python opencv
  • MySQL中使用函数会使索引失效?
  • 金和OA C6任意文件读取漏洞 复现[附POC]
  • IP地址技术原理
  • 【网络安全】密码学基础
  • AWS AD Connector 的网络配置
  • kafka详解(三)
  • [Spring] SpringMVC 简介(二)
  • idea一些不太常用但是能提升编码效率的快捷键
  • vsto word属性信息 并读取
  • android之TextView自由选择复制
  • 【mysql】 bash: mysql: command not found
  • 鲲山科技:引入和鲸 ModelWhale,实现量化策略的高效迭代
  • PFSK152 3BSE018877R1 有源滤波器的定义
  • WebDAV之π-Disk派盘 + 恒星播放器
  • 亚马逊,速卖通,敦煌产品测评补单攻略:低成本、高安全实操指南
  • 常用linux解压命令
  • TensorFlow入门(二十二、梯度下降)
  • WPF中的多重绑定
  • 区块链在游戏行业的应用
  • uniapp快速入门系列(4)- 微信小程序开发
  • Kafka保证消息幂等以及解决方案
  • 接口测试用例设计
  • wireshark抓rtp包,提取出H265裸流数
  • Excel往Word复制表格时删除空格
  • 客户机操作系统已禁用 CPU。请关闭或重置虚拟机(解决)