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、查看日志
作者:罗阿红
出处:http://www.cnblogs.com/luoahong/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。