1 安裝docker
安裝軟體包以允許 apt 通過 HTTPS 使用存儲庫
zl@k8s-master:~$ sudo apt-get update 忽略:1 cdrom://[Debian GNU/Linux 11.5.0 _Bullseye_ - Official amd64 DVD Binary-1 20220910-10:40] bullseye InRelease 錯誤:2 cdrom://[Debian GNU/Linux 11.5.0 _Bullseye_ - Official amd64 DVD Binary-1 20220910-10:40] bullseye Release 請使用 apt-cdrom,通過它可以讓 APT 識别該盤片。apt-get upgdate 不能被用來加入新的盤片。 擷取:3 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB] 擷取:4 http://security.debian.org/debian-security bullseye-security/main Sources [160 kB] 擷取:5 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [189 kB] 正在讀取軟體包清單... 完成 E: 倉庫 “cdrom://[Debian GNU/Linux 11.5.0 _Bullseye_ - Official amd64 DVD Binary-1 20220910-10:40] bullseye Release” 沒有 Release 檔案。 N: 無法安全地用該源進行更新,是以預設禁用該源。 N: 參見 apt-secure(8) 手冊以了解倉庫建立和使用者配置方面的細節 sudo apt-get install apt-transport-https ca-certificates curl software-properties-common gnupg2 |
添加 Docker 的官方 GPG 密鑰
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg |
添加軟體源
root@dmaster:~# echo \ > "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ > $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null root@dmaster:~# cat /etc/apt/sources.list.d/docker.list deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable |
更新軟體清單
root@dmaster:~# apt update 命中:1 http://mirrors.huaweicloud.com/debian bullseye InRelease 命中:2 http://mirrors.huaweicloud.com/debian bullseye-updates InRelease 命中:3 http://security.debian.org/debian-security bullseye-security InRelease 擷取:4 https://download.docker.com/linux/debian bullseye InRelease [43.3 kB] 擷取:5 https://download.docker.com/linux/debian bullseye/stable amd64 Packages [14.7 kB] |
安裝 docker 引擎
|
配置阿裡雲的鏡像加速位址
root@dmaster:~# mkdir -p /etc/docker root@dmaster:~# tee /etc/docker/daemon.json <<-'EOF' > { > "registry-mirrors": ["https://e4vaaqhb.mirror.aliyuncs.com"] > } > EOF { "registry-mirrors": ["https://e4vaaqhb.mirror.aliyuncs.com"] } |
啟動docker并配置開機啟動
root@dmaster:~# systemctl start docker root@dmaster:~# ps -ef|grep docker root 34909 1 0 22:10 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock root 38131 3767 0 22:12 pts/0 00:00:00 grep docker root@dmaster:~# systemctl enable docker Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable docker |
将目前使用者加入 docker 使用者組
root@dmaster:~# usermod -aG docker $USER && newgrp docker |
2 安裝kuboard
建立一個安裝腳本
root@dmaster:~# vi start-kuboard.sh docker run -d \ --restart=unless-stopped \ --name=kuboard \ ##将 Kuboard Web 端口 80 映射到主控端的 80 端口(您可以根據自己的情況選擇主控端的其他端口) -p 80:80/tcp \ ##将 Kuboard Agent Server 的端口 10081/tcp 映射到主控端的 10081 端口(您可以根據自己的情況選擇主控端的其他端口) -p 10081:10081/tcp \ ##指定 KUBOARD_ENDPOINT 為 http://内網IP,如果後續修改此參數,需要将已導入的 Kubernetes 叢集從 Kuboard 中删除,再重新導入 -e KUBOARD_ENDPOINT="http://192.168.100.80:80" \ ##指定 KUBOARD_AGENT_SERVER 的端口為 10081,此參數與第 5 行中的主控端端口應保持一緻,修改此參數不會改變容器内監聽的端口 10081,例如,如果第 5 行為 -p 30081:10081/tcp 則應該修改為 -e KUBOARD_AGENT_SERVER_TCP_PORT="30081" -e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \ ##将持久化資料 /data 目錄映射到主控端的 /root/kuboard-data 路徑,請根據您自己的情況調整主控端路徑 -v /root/kuboard-data:/data \ eipwork/kuboard:v3 |
賦予腳本執行權限
root@dmaster:~# chmod u+x start-kuboard.sh root@dmaster:~# ls -l start-kuboard.sh -rwxr--r-- 1 root docker 291 10月 29 22:33 start-kuboard.sh |
啟動腳本,完成安裝
root@dmaster:~# ./start-kuboard.sh Unable to find image 'eipwork/kuboard:v3' locally v3: Pulling from eipwork/kuboard 39cf15d1b231: Pull complete ecd0ab02f0ae: Pull complete 225e08117bbd: Pull complete abcb1f095da7: Pull complete 1eeda1b6f001: Pull complete 4349852fff77: Pull complete 1f029b610fdb: Pull complete 4df394d7d606: Pull complete 3c697407405f: Pull complete ee935ad7cf4e: Pull complete 09e01f13e911: Pull complete 4e388503d89a: Pull complete 35e609fe422f: Pull complete 2e14fa3ae7d7: Pull complete cec83c92c2a8: Pull complete d6932e6ef2a1: Pull complete Digest: sha256:0ea7d38afa2bb31ae178f8dc32feeccd480376097a2e3b7423750d02f123fa8c Status: Downloaded newer image for eipwork/kuboard:v3 1379dacf82df9b6a53e13ec4b0f9d31758d7c6b59e0ac387c894eba90566ed8a |
嘗試通路kuborad web管理界面
預設賬号密碼如下:
使用者名: admin
密 碼: Kuboard123
登入後按照提示導入k8s叢集即可