rancher安装k8s

官方文档

https://docs.rancher.cn/rancher2.5/

安装rancher

坑:ubuntu很多版本报错,github已提交bug

方式1:

sudo docker run -d --restart=unless-stopped -p 8080:80 -p 443:443 --privileged rancher/rancher:v2.5.3

方式二:docker-compose.yaml

version: '3'
services:
  rancher:
    image: rancher/rancher:v2.5.3
    privileged: true
    restart: unless-stopped
    ports:
      - 8080:80
      - 8443:443
    volumes:
      - ./data:/var/lib/rancher

安装kubectl客户端

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum clean all && yum makecache
yum install -y kubectl
kubectl version //查看版本

配置kubectl config:

mkdir -p ~/.kube
touch ~/.kube/config
vi ~/.kube/config //粘贴rancher中集群kubeconfig文件

rancher安装k8s

rancher添加节点

命令拿到节点服务器执行
posted @ 2022-09-15 15:50  Jeff的技术栈  阅读(159)  评论(0编辑  收藏  举报
回顶部