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
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Grafana] Easily install Grafana on Kubernetes using a Helm chart.

Posted on December 30, 2024January 2, 2025 By nim No Comments on [Grafana] Easily install Grafana on Kubernetes using a Helm chart.

Contents

Toggle
  • 1) Install Grafana using Helm chart.
  • 2) Configure authentication in Grafana.
    • 2.1) Login Grafana by Azure or Microsoft account.
  • Issue

1) Install Grafana using Helm chart.

ở bài này mình xin hướng dẫn cài bạn cài grafana trên k8s bằng helm chart:

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

helm install my-release grafana/grafana

Chúng ta cần chú ý value 1 chút:
Mình cần tạo ingress cho grafana luôn nên mình sẽ cần update values of helm install 1 chút

ingress:
  enabled: true
  ingressClassName: nginx
  annotations:
    cert-manager.io/issuer: selfsigned-issuer-grafana
    cert-manager.io/issuer-kind: Issuer
  hosts:
    - grafana.nimtechnology.com
  tls:
    - hosts:
        - grafana.nimtechnology.com
      secretName: tls-grafana-ingress

với helm values trên thì nó tự động tạo 1 grafana secret và store pass admin ở đây. Bạn sẽ dụng pass ở đây để login vào hệ thống.

Tiếp bạn thực hiện login vào grafana:

2) Configure authentication in Grafana.

2.1) Login Grafana by Azure or Microsoft account.

Log in to Azure Portal, then click Microsoft Entra ID in the side menu.
Nếu bạn chưa biêt tạo Application Registrations trên Azure thì tham khao mược này ở bên dưới này:

[Rancher] Login Rancher by Azure ID or MicroSoft account.

Sau đó chúng ta đá có 1 application registration

Vì ở đây mình có sãn
Tiếp đến chúng ta cần cung cấp Redirect URL để dựa trên domain của web của chúng ta

Tiếp đến bạn cần tạo 1 client credential và lấy ra client secret:

Bạn cần copy value ở trên vì nó sẽ là client_secret
Tiếp đến client_id sẽ là Application (client) ID
tenant_id sẽ là: Directory (tenant) ID

Bạn sẽ cần thay thế các value dựa theo chỉ dẫn bên trên:

grafana.ini:
  auth.azuread:
    enabled: true
    client_id: <client_id>
    client_secret = <client_secret>
    scopes: openid email profile User.Read
    auth_url: https://login.microsoftonline.com/<tenant_id >/oauth2/v2.0/authorize
    token_url: https://login.microsoftonline.com/<tenant_id >/oauth2/v2.0/token
    api_url: https://graph.microsoft.com/oidc/userinfo
    redirect_uri: https://grafana.nimtechnology.com/login/azuread
    skip_org_role_sync: false
    role_attribute_strict: false
    allow_assign_grafana_admin: false
    skip_org_role_sync: true
    use_pkce: true

Nhưng mà nếu bạn để secret trong helm value thì rất là kém bảo mật
Chúng ta sẽ đưa client_secret vào trong envionment:

secret:

Và value file như sau:

envValueFrom:
   GF_AUTH_AZURE_OAUTH_CLIENT_SECRET:
     secretKeyRef:
       name: grafana-azure
       key: GF_AUTH_AZURE_OAUTH_CLIENT_SECRET
grafana.ini:
  security:
    allow_embedding: true
    cookie_samesite: none
    cookie_secure: true
  server:
    domain: https://grafana.nimtechnology.com  
    root_url: https://grafana.nimtechnology.com
  auth.azuread:
    enabled: true
    client_id: ${GF_AUTH_AZURE_OAUTH_CLIENT_SECRET}
    client_secret = <client_secret>
    scopes: openid email profile User.Read
    auth_url: https://login.microsoftonline.com/<tenant_id >/oauth2/v2.0/authorize
    token_url: https://login.microsoftonline.com/<tenant_id >/oauth2/v2.0/token
    api_url: https://graph.microsoft.com/oidc/userinfo
    redirect_uri: https://grafana.nimtechnology.com/login/azuread
    skip_org_role_sync: false
    role_attribute_strict: false
    allow_assign_grafana_admin: false
    skip_org_role_sync: true
    use_pkce: true

Nếu bạn thấy việc nhấn vào Sign in with Microsoft rất là mất thời gian thì bạn có thể thêm 1 option auto_login: true trong phần: auth.azuread:

Grafana tự động đưa người dụng đến phần login Microsoft

Issue

https://community.grafana.com/t/azure-ad-oauth2-authentication-redirect-uri-error/117349/5

Coding, Grafana

Post navigation

Previous Post: [AWS] Filtering Subnets in Different Availability Zones for EFS Mount Targets with Terraform
Next Post: [Terminal/Huh] Build Terminal Form By golang.

More Related Articles

[Popup/Ajax] Tạo popup(modal/bootstrap) insert data bằng ajax và php Coding
[nodeJs] Resovle the issue: npm ERR! cb() never called! Coding
[Grafana] Bar Gause – Vẽ chart Grafana kiểu sóng âm nhạc Grafana
[Microsoft] How to disable Microsoft Entra multi-factor authentication MFA from an admin perspective Azure Cloud
[Loadtest/vegeta] Why did I choose Vegeta to load test? I like it Coding
[Grafana] Hướng dẫn nhúng (Embedding) Grafana Dashboard vào Iframe HTML / web của bạn Coding

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

  • [AWS/EKS] Cache Docker image to accelerate EKS container deployment. July 10, 2025
  • [Laravel] Laravel Helpful June 26, 2025
  • [VScode] Hướng dẫn điều chỉnh font cho terminal June 20, 2025
  • [WordPress] Hướng dấn gửi mail trên WordPress thông qua gmail. June 15, 2025
  • [Bitbucket] Git Clone/Pull/Push with Bitbucket through API Token. June 12, 2025

Archives

  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • 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
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.