Skip to content

Observability stack: include metrics, logging, tracing monitoring and alerting!

Notifications You must be signed in to change notification settings

kubeservice-stack/OpsCenter

Repository files navigation

Observability-stack

Lint and Test Charts

Observability Stack 是基于云原生组件构建的OpsCenter系统。 包括

基于Prometheusmetrics监控和报警

基于Loki的异构logging 监控、报警 和 搜索

基于Tempotracing 的计算、报警 和 查询

设计技术

  1. kube-prometheus stack
  2. Prometheus Operator
  3. Grafana
  4. Loki
  5. Promtail
  6. Tempo
  7. Opentelemetry

设计文档

整体设计文档: https://kubeservice.cn/2022/11/07/devops-k8s-observability-stack/

监控体系设计:

日志体系设计:

调用链设计:

  • Open Telemetry:

要求

  • Kubernetes 1.16+
  • Helm 3+

其他条件

  • kubelet、apiserver、scheduler 和 controller manager 开启metrics
  • 如需要开启GPU监控,需确认节点上有配置使用nvidia runtime

docker需要配置:

/etc/docker/daemon.json

{
    "default-runtime": "nvidia",
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}

containerd需要配置:

/etc/containerd/config.toml

  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
    BinaryName = "/usr/bin/nvidia-container-runtime"
    CriuImagePath = ""
    CriuPath = ""
    CriuWorkPath = ""
    IoGid = 0
    IoUid = 0
    NoNewKeyring = false
    NoPivotRoot = false
    Root = ""
    ShimCgroup = ""
    SystemdCgroup = false

集群内部署

metrics 部署

$ cd kubeservice-stack/OpsCenter/metrics/
$ kubectl create ns monitoring

$ kubectl apply -f ./metrics/crds/ .
$ vim value.yaml #编辑环境配置

$ helm install metrics . --namespace monitoring  ## 部署

$ helm upgrade metrics . --namespace monitoring  ## 更新配置

$ helm uninstall metrics --namespace monitoring  ## 卸载

或者 通过 helm template 方式部署

$ helm template metrics . --namespace monitoring > metrics-allinone.yaml
$ kubectl create -f metrics-allinone.yaml

logging 部署

$ cd kubeservice-stack/OpsCenter/logging/

$ cd loki
$ vim value.yaml #编辑环境配置
$ helm install loki . --namespace monitoring  ## 部署
$ helm upgrade loki . --namespace monitoring  ## 更新配置
$ helm uninstall loki --namespace monitoring  ## 卸载

$ cd promtail
$ vim value.yaml #编辑环境配置
$ helm install promtail . --namespace monitoring  ## 部署
$ helm upgrade promtail . --namespace monitoring  ## 更新配置
$ helm uninstall promtail --namespace monitoring  ## 卸载

或者 通过 helm template 方式部署

$ helm template loki . --namespace monitoring > loki-allinone.yaml
$ kubectl apply -f loki-allinone.yaml

$ helm template promtail . --namespace monitoring > promtail-allinone.yaml
$ kubectl apply -f promtail-allinone.yaml

tracing 部署

$ cd kubeservice-stack/OpsCenter/tracing/

$ cd tempo
$ vim value.yaml #编辑环境配置
$ helm install tempo . --namespace monitoring  ## 部署
$ helm upgrade tempo . --namespace monitoring  ## 更新配置
$ helm uninstall tempo . --namespace monitoring  ## 卸载

或者 通过 helm template 方式部署

$ helm template tempo . --namespace monitoring > tempo-allinone.yaml
$ kubectl apply -f tempo-allinone.yaml

集群外部署

TODO

效果演示

Opscenter Demo