Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log & Monitor
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Datadog] Using DataDog to monitor all services on kubernetes

Posted on March 19, 2023March 23, 2023 By nim No Comments on [Datadog] Using DataDog to monitor all services on kubernetes

Nếu công ty của bạn giàu và yêu cầu bạn phải sử dụng datadog thì Let’s do it.

Contents

  • 1) Install DataDog on Kubernetes.
  • 2) How will Datadog monitor your cluster or service?
    • 2.1) Collect data based on packages that are designed by DataDog.
      • 2.1.1) Monitor RabbitMQ by DataDog on Kubernetes.
    • 2.2) Kubernetes Integrations Autodiscovery
  • 2.3) Install the Datadog window to monitor K8s windows and Windows Pods
  • 3) Signed to isolate the logs or metrics about each Cluster or Environment

1) Install DataDog on Kubernetes.

Install DataDog via helm.

helm repo add datadog https://helm.datadoghq.com
helm repo update

Value file:

datadog:
  site: datadoghq.com
  apiKey: 5d6c38e260bea6229c2916fc7eaXXXXX
  logs:
    enabled: true
    containerCollectAll: true

Vì để datadog chất nhận data của bạn gửi lên datadog.
thì apiKey là thử quan trong nhất.

Vậy là bạn đã datadog trong cluster

Và các bạn có thể tham khảo full value của nó ở đây.
https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml

2) How will Datadog monitor your cluster or service?

Sau khi bạn cài đặt datadog trên cluster k8s của bạn, bạn sẽ thấy chúng tự động collect metrics và data trong cluster của bạn tự động nhất 1 các có thể.

Và bạn có thể click vào bất cứ dashboard nào để khám phá.
Wow Dash board khá đẹp.

Sau khi cài đặt mình bặt đầu rút ra thứ hấp dẫn của Datadog.

2.1) Collect data based on packages that are designed by DataDog.

Theo mình nghĩ do chúng ta trả tiền cho datadog. Thì chúng ta sẽ không cần lo lắng về store metrics ở đâu.
Còn 1 cái hay nữa là bạn sẽ được cung cấp dashboard mà nó được vẽ bởi datadog.

Bạn có thể vào repo: https://github.com/DataDog/integrations-core

2.1.1) Monitor RabbitMQ by DataDog on Kubernetes.

Yeah, Datadog có hỗ trợ
https://github.com/DataDog/integrations-core/tree/master/rabbitmq

Enable monitoring on RabbitMQ.
RabbitMQ exposes metrics in two ways: the RabbitMQ Management Plugin and the Rabbitmq Prometheus Plugin. 

Bạn sẽ cần thêm 2 plugins sau: rabbitmq_management, rabbitmq_prometheus
port manager: 5672 or 15672
port metrics: 15692

Thường thì prometheus sẽ collect ở 15692

RabbitMQ Management Plugin.

Và bạn sửa file values như dưới.

atadog:
  logs:
    enabled: true
    containerCollectAll: true
  confd:
    rabbitmq.yaml: |-
      instances:
        - rabbitmq_api_url: http://<rabbit_service_name>.<namespace>:5672/api/

lúc này bạn sẽ cần exec vào pod

apt update -y && apt install vim -y
agent status >> debug.txt

vim debug.txt

Và nếu bạn thấy rabbit như bên dưới thì ok

    rabbitmq (3.4.0)
    ----------------
      Instance ID: rabbitmq:15b01df4a0b63830 [OK]
      Configuration Source: file:/etc/datadog-agent/conf.d/rabbitmq.yaml
      Total Runs: 3,502
      Metric Samples: Last Run: 1,328, Total: 4,650,650
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 1, Total: 3,502
      Average Execution Time : 134ms
      Last Execution Date : 2023-03-19 08:45:08 UTC (1679215508000)
      Last Successful Execution Date : 2023-03-19 08:45:08 UTC (1679215508000)

RabbitMQ Prometheus Plugin.

Datadog cũng có thể collect metrics như prometheus.

datadog:
  logs:
    enabled: true
    containerCollectAll: true
  confd:
    rabbitmq.yaml: |-
      instances:
        - prometheus_plugin:
            url: "http://rabbitmq.rabbits:15692"

Lúc này bạn quay lại dataDog để query.

2.2) Kubernetes Integrations Autodiscovery

Mình đã sử dụng prometheus và mình rất thích tính năng Auto Discovery.
Nhưng tin bùn là tính năng này bị remove trên rất nhiều package của Datadog.

https://github.com/DataDog/integrations-core/pull/13919

Nếu bạn muốn monitor cái gì thì bạn phải nói với ông controll Datadog nhé.

2.3) Install the Datadog window to monitor K8s windows and Windows Pods

Có 1 cái hơi chướng là bên mình có chạy windows pod trên k8s.
Nêu bạn chưa biết dựng k8s windows như thế nào thì tham khảo bài sau:

[AWS] Creating EKS windows on AWS and Running windows pods

Đây là doc của datadog hướng dẫn cài agent trên windows k8s
https://docs.datadoghq.com/agent/troubleshooting/windows_containers/

Mình có get được valuefile ở đây.
https://github.com/DataDog/helm-charts/issues/955

Về nguyên tắc thì bạn sẽ cài 1 full datadog on linux k8s.
Tiếp đến là bạn cài agent datadog windows và join datadog windows vào datadog linux.

targetSystem: windows
existingClusterAgent:
  join: true
  serviceName: "datadog-cluster-agent" # from the first Datadog Helm chart
  tokenSecretName: "<EXISTING_DCA_SECRET_NAME>" # from the first Datadog Helm chart


# Disable datadogMetrics deployment since it should have been already deployed with the first chart.
datadog-crds:
  crds:
    datadogMetrics: false

# Disable kube-state-metrics deployment
datadog:
  kubeStateMetricsEnabled: false
  apiKey: "ahihi"
  clusterName: "ahihi"
  dogstatsd:
    useHostPort: true

clusterAgent: 
  image:
    doNotCheckTag: true

agents:
  image:
    doNotCheckTag: true       
  priorityClassName: system-node-critical
  tolerations:
  - effect: NoSchedule
    key: os
    operator: Equal
    value: windows

3) Signed to isolate the logs or metrics about each Cluster or Environment

Chúng ta có rất nhiều clusters và rất nhiều dịch vụ gửi metrics hoặc log về Datadog
và đôi khi các dịch vụ đó trùng tên nhau
Vd: như là trên các cluster khách nhau thì bạn đều cài ingress-nginx vậy làm sao để biêt ingress này trên cluster nào.

với Kubernetes thì bạn chỉ cần ghi tên cluster trong values:

datadog:
  ...
  clusterName: k0s-nimtechnology
  ...
....
Giờ bạn vào các dashboard kube bạn sẽ thấy có Ô cluster
Khi query trong Metrics Explorer
DataDog, Kubernetes & Container

Post navigation

Previous Post: [Metrics Server] Failed to make webhook authorizer request: the server could not find the requested resource
Next Post: [Nextcloud] Can’t download files to have a size bigger than 2Gi on NextCloud – RaspBerry

More Related Articles

[Helm Chart] Tìm hiểu – (gạch giữa), _ (gạch dưới), dấu chấm “.” trong helm chart Helm Chart
[letsencrypt] DST Root CA X3 Expiration (September 2021) BareMetal
[Longhorn] Store label with longhorn in order to create many storage classes and have many storage styles “SSD, HDD, fast, slow” Kubernetes & Container
[note – link] Note các links về tài liệu hay Kubernetes & Container
[Datree] Admission Controllers Or CLI? Kubernetes Policy Validations with Datree Kubernetes & Container
[Harbor] Cấu hình Proxy Cache <- Docker Hub trên Harbor. Harbor

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • Experiences for IP Addresses Shortage on EKS Clusters March 29, 2023
  • [Talisman] Discover the sensitive information in your code. March 28, 2023
  • [Prometheus/Grafana] Install Prometheus and Grafana on ubuntu. March 27, 2023
  • [Kong Gateway] WebSocket connection failed March 26, 2023
  • [Nextcloud] Can’t download files to have a size bigger than 2Gi on NextCloud – RaspBerry March 24, 2023

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • MetalLB
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.