rancher2,x在線安裝k8s(單機ubuntu18)

離線安裝可以利用在線安裝時用的docker鏡像

準備

操作系統:ubuntu-18.04.4-desktop-amd64
docker官方文檔:https://docs.docker.com/get-docker/
rancher2官方文檔:https://rancher.com/docs/rancher/v2.x/en/overview/

配置靜態IP和hosts

配置靜態IP直接百度(ubuntu18的server版和desktop版還有區別)

#配置hosts
$ sudo vim /etc/hosts
127.0.0.1		localhost
192.168.104.116	rtvm
#IP和主機名按實際配置

關防火牆

更推薦的做法是,參考rancher2的REQUIRED PORTS打開相應端口

$ sudo ufw disable

安裝docker

#移除老版本docker
$ sudo apt-get remove docker docker-engine docker.io containerd runc

#相關工具,依賴等
$ sudo apt-get install \
    apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    
#設置安裝源
#Docker’s official GPG key   
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) stable"

#正式安裝docker
$ sudo apt-get update
$ sudo apt-get install -y docker-ce docker-ce-cli containerd.io

# 配置docker鏡像
$ sudo vim /etc/docker/daemon.json
# 本人用了163鏡像
{
    "registry-mirrors": ["http://hub-mirror.c.163.com"]
}
$ sudo systemctl restart docker.service

安裝rancher-v2.4.4

本人使用的是2.4.4版本,可以嘗試其他版本

#官方腳本拉取docker鏡像
$ sudo sh -c \
	"$(wget https://github.com/rancher/rancher/releases/download/v2.4.4/rancher-mirror-to-rancher-org.sh -O -)"

#啓動rancher-v2.4.4
$ sudo docker run -d --restart=unless-stopped \
  -v /etc/rancher:/etc/rancher
  -p 80:80 -p 443:443 rancher/rancher:v2.4.4

安裝k8s

瀏覽器訪問rancher

瀏覽器訪問:https://你的ip
第一次登陸需要設置登陸密碼
登陸頁

設置服務器http地址(多節點時請保證其他節點能訪問到)

配置服務器地址

添加集羣

點擊[add Cluster]
添加集羣
本人選的[Custom]。可以按需要選擇
Custom
本人只填了集羣名
填集羣名
點下一步[Next]
master節點需要勾上[etcd],[Control Palne],[Worker],勾選時注意下方腳本變化
將生成的腳本複製到終端運行
生成的腳本

點擊[Done],等待安裝完成,界面中能看到當前的安裝動作
等待安裝完成
安裝成功後界面如下

安裝成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章