Try   HackMD

Day 13 Kubernetes 戰力檢視-Rancher Dashboard 安裝基礎操作篇

本日重點與方向 (TAG): Rancher、Rancher Dashboard、kubernetes、k8s、Pod、Grafana、prometheus
今天將會介紹使用 Bare Metal 進行 Kubernetes 監控的 Rancher Dashboard 的部署,並對於先前搞定的 kubernetes 功能進行整合,這邊適用 Docker 進行安裝的,基本上就是安裝筆記居多,需要先準備一下 k8s 叢集,配置上就是部署 Image 就可以弄好啦,後面還有再搞一下 Prometheus 與 Grafana 的整合使用,還有一些進階一點的去看官方網站 吧,詳細的操作還是去看看大神的文吧。

本次使用設備資訊

Network Switch

  • 數量: 1
  • 型號: D-Link 1210-28 (L2 Switch)

Bare Metal (Master Node)

  • 數量: 3
  • Model Name: HP Z230
  • Ubuntu: 16.04 / 18.04
  • Docker Version: 19.03
  • CPU: E5-1230_v3 ^ 1
  • RAM: 8 GB
  • Disk: 500 GB (SAS)
  • Network: 1Gbps

前置動作

Ubuntu 上 Docker 安裝

其他環境參考:https://docs.docker.com/install/linux/docker-ce/ubuntu/

  • 使用 root 權限操作
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
service docker start

Rancher DashBoard 環境安裝

參考:https://github.com/rancher/rancher
Release Version:https://github.com/rancher/rancher/releases/

  • Release 版本:rancher/rancher:latest
  • Stable 版本:rancher/rancher:stable
docker run -d --restart=unless-stopped -p 8080:80 -p 8443:443 rancher/rancher:latest
  • Rancher DashBoard 執行狀態確認:
docker ps
  • 示意圖
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Rancher DashBoard 首次登入

https:127.0.0.1:8443

https 安全性問題

  • 點選進階
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 點選繼續前往
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

設定 admin 登入密碼

  • 輸入 admin 密碼 (沒限制長度與大小寫,最低一個字元)
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

設定連線頁面的網址 (https 安全性連線的)

  • 基本上按繼續即可 (使用 Domain 連線的可在這邊處理)
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 進入 Rancher DashBoard 管理介面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Rancher DashBoard 託管叢集添加

添加叢集

  • 點選 Add Cluster
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

選擇叢集方案 (kubernetes / k3s )

  • 點選使用 Import an existing cluster
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

為叢集定義名稱 (在 Rancher DashBoard 識別)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

派送 Rancher DashBoard 監測的服務進入叢集之中

  • 下方了個都可以使用,建議使用下方的那一個(紅框處)
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 叢集 Master Node 派送 Rancher DashBoard 設定檔
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Rancher DashBoard 上叢集添加狀態檢查

  • 狀態 Pending >> Waiting >> Active
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Rancher DashBoard 託管叢集監控管理

叢集總狀態

  • 點擊叢集名稱
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 進入該叢集監控頁面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

叢集遠端指令控制(kubectl)

  • 在叢集監控頁面上,按下 Launch kubectl
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 進入 kubectl 頁面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 指令測試
kubectl get nodes -o wide

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

節點狀態列表

  • 點選項目欄 Node 部分
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 獲得叢集節點列表
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

單一節點狀態總覽

  • 叢集節點列表 (點下叢集節點的名字)
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 獲得單一節點的主機狀態
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

NameSpace 分類列表

  • 在叢集監控頁面上,點選 Project/NameSpace
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 獲取叢集 NameSpace列表
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Rancher DashBoard + Grafana 數據繪圖顯示支援

開啟 Grafana 監控功能

  • 在叢集監控頁面上,點選右上方的 Enable Monitoring to see live metrics
  • 點選下方的 Enable Persistent Storage For Grafana

叢集主機cluster-Node硬碟不大者,可將佔用硬碟大小改成1G即可,設太大會回報硬碟可用容量不夠。

  • 等待 Grafana 監控模板生成

驗收 Grafana 數據圖表支援~

  • 叢集監控頁面
  • 硬體狀態監控圖表
  • 軟體服務狀態監控與叢集事件

這樣就完成 Rancher DashBoard 基礎功能了~