linux cpu占用率如何看
250
2022-10-13
k8s之Weave Scope监控
用 Weave Scope 监控集群
创建 Kubernetes 集群并部署容器化应用只是第一步。一旦集群运行起来,我们需要确保一起正常,所有必要组件就位并各司其职,有足够的资源满足应用的需求。Kubernetes 是一个复杂系统,运维团队需要有一套工具帮助他们获知集群的实时状态,并为故障排查提供及时和准确的数据支持。
Kubernetes 常用的监控方案
Weave Scope
Weave Scope 是 Docker 和 Kubernetes 可视化监控工具。Scope 提供了至上而下的集群基础设施和应用的完整视图,用户可以轻松对分布式的容器化应用进行实时监控和问题诊断。
安装 Scope
安装 Scope 的方法很简单,执行如下命令:
kubectl apply -f "version | base64 | tr -d '\n')&k8s-service-type=NodePort"部署成功后,有如下相关组件:
[root@k8s-master ~]# kubectl apply -f "version | base64 | tr -d '\n')&k8s-service-type=NodePort"
namespace/weave unchanged
serviceaccount/weave-scope created
clusterrole.rbac.authorization.k8s.io/weave-scope configured
clusterrolebinding.rbac.authorization.k8s.io/weave-scope configured
deployment.apps/weave-scope-app created
service/weave-scope-app created
deployment.apps/weave-scope-cluster-agent created
daemonset.apps/weave-scope-agent created
[root@k8s-master ~]# kubectl get pod -n weave
NAME READY STATUS RESTARTS AGE
weave-scope-agent-bct26 1/1 Running 0 30s
weave-scope-agent-vzdbr 0/1 ContainerCreating 0 30s
weave-scope-agent-xvwsp 0/1 ContainerCreating 0 30s
weave-scope-app-cf544d8c4-v9x5z 1/1 Running 0 30s
weave-scope-cluster-agent-6466d94ccf-r4vql 0/1 ContainerCreating 0 30s
[root@k8s-master ~]# kubectl get pod -n weave
NAME READY STATUS RESTARTS AGE
weave-scope-agent-bct26 1/1 Running 0 57s
weave-scope-agent-vzdbr 1/1 Running 0 57s
weave-scope-agent-xvwsp 1/1 Running 0 57s
weave-scope-app-cf544d8c4-v9x5z 1/1 Running 0 57s
weave-scope-cluster-agent-6466d94ccf-r4vql 1/1 Running 0 57s
[root@k8s-master ~]# kubectl get svc -n weave
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
weave-scope-app NodePort 10.108.59.226
DaemonSet weave-scope-agent,集群每个节点上都会运行的 scope agent 程序,负责收集数据。
Deployment weave-scope-app,scope 应用,从 agent 获取数据,通过 Web UI 展示并与用户交互。
Service weave-scope-app,默认是 ClusterIP 类型,已经在上面的命令中添加了参数k8s-service-type=NodePort修改为 NodePort。
使用 Scope
浏览器访问 默认显示当前所有的 Controller(Deployment、DaemonSet 等)。
拓扑结构
实时资源监控
可以在 Scope 中查看资源的 CPU 和内存使用情况。
支持的资源有 Host、Pod 和 Container。
在线操作
强大的搜索功能
Weave Scope 界面极其友好,操作简洁流畅。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~