Kubernetes進階實戰讀書筆記:Helm實踐部署weave-scope監控


 一、環境准備下載

1、搜索weave倉庫

[root@master ~]# helm search repo weave
NAME CHART VERSION	APP VERSION	DESCRIPTION 
aliyuncs/weave-cloud	0.3.7 1.4.0 Weave Cloud is a add-on to Kubernetes which pro...
aliyuncs/weave-scope	1.1.8 1.12.0 A Helm chart for the Weave Scope cluster visual...
stable/weave-cloud 0.3.7 1.4.0 Weave Cloud is a add-on to Kubernetes which pro...
stable/weave-scope 1.1.10 1.12.0 A Helm chart for the Weave Scope cluster visual...

2、下載遠程安裝包到本地並解壓

[root@master ~]# helm fetch stable/weave-scope
[root@master ~]# tar xf weave-scope-1.1.10.tgz

3、修改ClusterIP為NodePort

[root@master ~]# sed -i "s@\ type:\ \"ClusterIP\"@ type: \"NodePort\"@" weave-scope/values.yaml

4、創建weave-scope命名空間

[root@master ~]# kubectl create namespace weave-scope
namespace/weave-scope created

二、安裝驗證

1、安裝

[root@master ~]# helm install -n weave-scope common-service -f weave-scope/values.yaml weave-scope/
NAME: common-service
LAST DEPLOYED: Mon Jul 27 17:27:54 2020
NAMESPACE: weave-scope
STATUS: deployed
REVISION: 1
NOTES:
You should now be able to access the Scope frontend in your web browser, by
going to the address or hostname of any node in the cluster, using http 
and the port given by:

SCOPE_PORT=$(kubectl -n weave-scope get svc common-service-weave-scope \
-o jsonpath='{.spec.ports[?(@.name==http)].nodePort}'); echo $SCOPE_PORT

Most likely one or more of the URLs given by this pipeline will work:

SCOPE_PORT=$(kubectl -n weave-scope get svc \
-o jsonpath='{.spec.ports[?(@.name==http)].nodePort}'); \
kubectl get nodes -o jsonpath='{.items[0].status.addresses[*].address}' | \
xargs -I{} -d" " echo http://{}:$SCOPE_PORT
For more details on using Weave Scope, see the Weave Scope documentation:

https://www.weave.works/docs/scope/latest/introducing/

2、驗證服務列表

[root@master ~]# helm list -n weave-scope
NAME NAMESPACE REVISION	UPDATED STATUS CHART APP VERSION
common-service	weave-scope	1 2020-07-27 17:27:54.730013979 +0800 CST	deployed	weave-scope-1.1.10	1.12.0

3、驗證服務狀態

[root@master ~]# helm status common-service -n weave-scope
NAME: common-service
LAST DEPLOYED: Mon Jul 27 17:27:54 2020
NAMESPACE: weave-scope
STATUS: deployed
REVISION: 1
NOTES:
You should now be able to access the Scope frontend in your web browser, by
going to the address or hostname of any node in the cluster, using http 
and the port given by:

SCOPE_PORT=$(kubectl -n weave-scope get svc common-service-weave-scope \
-o jsonpath='{.spec.ports[?(@.name==http)].nodePort}'); echo $SCOPE_PORT

Most likely one or more of the URLs given by this pipeline will work:

SCOPE_PORT=$(kubectl -n weave-scope get svc \
-o jsonpath='{.spec.ports[?(@.name==http)].nodePort}'); \
kubectl get nodes -o jsonpath='{.items[0].status.addresses[*].address}' | \
xargs -I{} -d" " echo http://{}:$SCOPE_PORT
For more details on using Weave Scope, see the Weave Scope documentation:

https://www.weave.works/docs/scope/latest/introducing/

4、驗證pod svc deploy

[root@master ~]# kubectl get all -n weave-scope -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/weave-scope-agent-common-service-88zg9 1/1 Running 0 4m20s 192.168.118.19 nodes1 <none> <none>
pod/weave-scope-agent-common-service-mtgs8 1/1 Running 0 4m20s 192.168.118.4 nodes2 <none> <none>
pod/weave-scope-agent-common-service-s4pgv 1/1 Running 0 4m20s 192.168.118.18 master <none> <none>
pod/weave-scope-cluster-agent-common-service-76f8fb44f6-k4h9n 1/1 Running 0 4m20s 10.244.2.147 nodes2 <none> <none>
pod/weave-scope-frontend-common-service-6949c697bf-vchbh 1/1 Running 0 4m20s 10.244.2.146 nodes2 <none> <none>

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
service/common-service-weave-scope NodePort 10.99.171.162 <none> 80:31655/TCP 4m20s app=weave-scope,component=frontend,release=common-service

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES SELECTOR
daemonset.apps/weave-scope-agent-common-service 3 3 3 3 3 <none> 4m20s weave-scope-agent weaveworks/scope:1.12.0 app=weave-scope,component=agent,release=common-service

NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
deployment.apps/weave-scope-cluster-agent-common-service 1/1 1 1 4m20s weave-scope-cluster-agent weaveworks/scope:1.12.0 app=weave-scope,component=cluster-agent,release=common-service
deployment.apps/weave-scope-frontend-common-service 1/1 1 1 4m20s weave-scope-frontend weaveworks/scope:1.12.0 app=weave-scope,component=frontend,release=common-service

NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
replicaset.apps/weave-scope-cluster-agent-common-service-76f8fb44f6 1 1 1 4m20s weave-scope-cluster-agent weaveworks/scope:1.12.0 app=weave-scope,component=cluster-agent,pod-template-hash=76f8fb44f6,release=common-service
replicaset.apps/weave-scope-frontend-common-service-6949c697bf 1 1 1 4m20s weave-scope-frontend weaveworks/scope:1.12.0 app=weave-scope,component=frontend,pod-template-hash=6949c697bf,release=common-service

三、web頁面截圖

1、瀏覽器輸入:http://192.168.118.18:31655

2、查看pod配置

 3、添加刪除pod

                                                 

 4、exec shell

 5、查看日志


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM