Day5-07 通过helm3部署weave-scope

一、背景

Weave Scope是Docker和Kubernetes的可视化监控管理软件。这个项目会自动生成容器之间的关系图,方便理解容器之间的关系,也方便监控容器化和微服务化的应用。
部署成功后,有如下相关组件:

  • DaemonSet:weave-scope-agent,集群每个节点上都会运行的 scope agent 程序,负责收集数据。
  • Deployment:weave-scope-frontend,scope应用,从agent获取数据,通过Web UI展示并与用户交互。
  • Service:支持NodePort和ClusterIP两种类型


二、通过 helm3 部署 weave-scope

官方GitHub:
https://github.com/weaveworks/scope
https://github.com/weaveworks/scope/tree/master/examples/k8s

shell> helm install weave-scope stable/weave-scope --namespace kube-system
  • 通过 NodePort 类型的 Service 方式登录
# 将 type: ClusterIP 修改为 type: NodePort
shell> kubectl edit svc -n kube-system weave-scope-weave-scope
  • 通过 ClusterIP 类型的 Service 方式登录(默认)
shell> cat > ingress.yaml << "EOF"
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: weave-scope-weave-scope
  namespace: kube-system
spec:
  rules:
  - host: weave-scope.k8s.maoxj.com.cn
    http:
      paths:
      - path: /
        backend:
          serviceName: weave-scope-weave-scope
          servicePort: 80
EOF

# 发布资源配置清单
shell> kubectl apply -f ingress.yaml

三、配置 dns 解析

weave-scope.k8s 10 IN A 10.65.24.10

四、访问 Web UI

  • 通过 NodePort 方式访问
    查看 Service 的 NodePort 对外暴露的端口,打开浏览器输入节点IP+端口,例如 http://10.65.24.21:30950/
  • 通过 Ingress 方式访问,需要配置 nginx vhost 文件
shell> cat > weave-scope.k8s.conf << "EOF"
  server {
      server_name weave-scope.k8s.maoxj.com.cn;
      location / {
         proxy_pass http://kubernetes_backend;
         proxy_set_header Host $http_host;
         proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
      }
  }
EOF
posted @ 2020-11-24 15:01  龍龍小宝  阅读(153)  评论(0编辑  收藏  举报