Docker and Kubernetes -- 監控(weave scope)

docker經常使用的監控工具node

weave scope

簡介

  • Weave Scope是Docker和Kubernetes的可視化監控管理軟件
  • Weave Scope 會自動生成容器之間的關係圖,方便理解容器之間的關係,也方便監控容器化和微服務化的應用

安裝部署

官方安裝文檔Installing Weave Scope:https://www.weave.works/docs/scope/latest/installing/#k8sgit

單節點(Single-node)部署安裝:

sudo curl -L git.io/scope -o /usr/local/bin/scope
sudo chmod a+x /usr/local/bin/scope
scope launch

訪問:http://localhost:4040docker


集羣實驗(Cluster)

實驗環境:Hostsapp

192.168.137.3
192.168.137.4
192.168.137.5

第一步:在每臺主機上運行curl

sudo curl -L git.io/scope -o /usr/local/bin/scope
sudo chmod a+x /usr/local/bin/scope

第二步:在每臺Host主機運行時添加集羣其餘主機微服務

# 192.168.137.3 主機運行:
scope launch 192.168.137.4 192.168.137.5

# 192.168.137.4 主機運行;
scope launch 192.168.137.3 192.168.137.5

# 192.168.137.5 主機運行;
scope launch 192.168.137.3 192.168.137.4

訪問(集羣內任意主機ip均可):http://localhost:4040工具


k8s集羣監控

第一步:下載url

╭─root@node1 ~  
╰─➤  kubectl apply -f "https://cloud.weave.works/k8s/scope.yaml?k8s-version=$(kubectl version | base64 | tr -d '\n')&k8s-service-type=NodePort" 

namespace/weave unchanged
serviceaccount/weave-scope configured
clusterrole.rbac.authorization.k8s.io/weave-scope configured
clusterrolebinding.rbac.authorization.k8s.io/weave-scope configured
deployment.apps/weave-scope-app configured
service/weave-scope-app configured
deployment.apps/weave-scope-cluster-agent configured
daemonset.extensions/weave-scope-agent configured

第二步:查看spa

╭─root@node1 ~  
╰─➤  kubectl get pod -n weave
NAME                                         READY   STATUS              RESTARTS   AGE
weave-scope-agent-26vhd                      0/1     ContainerCreating   0          96s
weave-scope-agent-qhbnb                      1/1     Running             0          96s
weave-scope-agent-vlf55                      1/1     Running             0          96s
weave-scope-app-f6df86749-s2674              1/1     Running             0          97s
weave-scope-cluster-agent-6546965c48-55d5c   0/1     ContainerCreating   0          97s
╭─root@node1 ~  
╰─➤  kubectl get deploy -n weave
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
weave-scope-app             1/1     1            1           109s
weave-scope-cluster-agent   0/1     1            0           109s
╭─root@node1 ~  
╰─➤  kubectl get svc -n weave
NAME              TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
weave-scope-app   NodePort   10.105.170.156   <none>        80:32634/TCP   2m1s

weave scope 還能夠監控宿主機


示例圖片

圖片來源:https://carey.akhack.com/2019/05/30/weave-scope%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9B%91%E6%8E%A7/code

相關文章
相關標籤/搜索