【吐血整理】KubeEdge在樹莓派上的安裝,小白再也不用怕安裝問題了
KubeEdge 是一個開源的系統,可將本機容器化應用編排和管理擴展到邊緣端設備, 它基于Kubernetes構建,為網路和應用程式提供核心基礎架構支持,并在云端和邊緣端部署應用,同步元資料,
文章目錄
- 開始之前
- 裝系統
- 設定掛載cgroup
- 關閉自動更新
- 設定WiFi
- 本文所有操作均在`su`賬戶下完成
- 安裝Docker
- 編譯`keadm`
- 安裝Golang
- 安裝make
- 下載編譯KubeEdge原始碼
- 加入集群
- 從云端獲取token
- 將樹莓派加入集群
- 量產邊緣節點
- 構造原型系統
- 生成鏡像
- 用讀卡器
- 基于網路
- 使用鏡像量產邊緣節點
- (未完成)設定自動初始化代碼
開始之前
裝系統
刷入Ubuntu系統,按照教程進行基本設定,
設定掛載cgroup
在/boot磁區中的/boot/cmdline.txt檔案開頭加上cgroup_enable=memory cgroup_memory=1,
關閉自動更新
apt autoremove --purge
dpkg-reconfigure -plow unattended-upgrades
reboot
設定WiFi
將/etc/netplan/50-cloud-init.yaml修改為這樣:
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
eth0:
dhcp4: true
optional: true
version: 2
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
"HUAWEI-PKAWX9_HiLink":
password: "87654321"
"yin_Home":
password: "409987654321"
本文所有操作均在su賬戶下完成
安裝Docker
以下內容摘自官方教程,
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=arm64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
編譯keadm
安裝Golang
wget https://golang.org/dl/go1.15.2.linux-arm64.tar.gz
tar -C /usr/local -xzf go1.15.2.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
export GOPATH="/root/go" #安裝程序中Golang只用一次所以不加到profile中
go version
安裝make
apt-get install -y make
下載編譯KubeEdge原始碼
git clone https://github.com/kubeedge/kubeedge $GOPATH/src/github.com/kubeedge/kubeedge
cd $GOPATH/src/github.com/kubeedge/kubeedge
make all WHAT=keadm
加入集群
從云端獲取token
在運行著cloudcore的云端執行:
keadm gettoken
記錄下輸出的token字串,
將樹莓派加入集群
cd $GOPATH/src/github.com/kubeedge/kubeedge/_output/local/bin
./keadm join --cloudcore-ipport=<云端的IP>:<cloudcore埠號,默認為10000> --edgenode-name=<為這個邊緣節點取名> --token=<從云端獲取到的token>
量產邊緣節點
樹莓派安裝KubeEdge的關鍵實際上只是一個keadm程式,因此可以在keadm編譯完成后直接放到其他樹莓派上使用而不再下載Golang編譯原始碼,
構造原型系統
從編譯安裝的系統中取出keadm程式和/etc/kubeedge檔案夾,在一個新SD卡中:
- 刷入經過基本設定的Ubuntu系統
- 按照前文所述的步驟安裝Docker
- 將
keadm上傳到/bin - 將
/etc/kubeedge檔案夾上傳到/etc/kubeedge
生成鏡像
用讀卡器
在Linux系統上:
dd bs=4M if=/dev/<SD卡設備名> | gzip | cat > rasp.img.gz
在Windows系統上:用Win32DiskImager讀取即可,
基于網路
選擇一個硬碟容量足夠的主機,記錄下IP地址,在原型系統上執行:
dd bs=4M if=/dev/mmcblk0 | gzip | ssh <目標主機IP> "cat > rasp.img.gz"
使用鏡像量產邊緣節點
對于每個樹莓派,將系統鏡像刷入SD卡,開機后執行:
keadm join --kubeedge-version=1.4.0 --cloudcore-ipport=<云端的IP>:<cloudcore埠號,默認為10000> --edgenode-name=<為這個邊緣節點取名> --token=<從云端獲取到的token>
即可完成設定,
(未完成)設定自動初始化代碼
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/254803.html
標籤:區塊鏈
上一篇:Java 加密篇之演算法總結
