$30 off During Our Annual Pro Sale. View Details »

How to probe prometheus & grafana. What is helm

How to probe prometheus & grafana. What is helm

How to probe prometheus & grafana. What is helm on shinjuku mokumoku programming vol.20

threetreeslight

November 17, 2018
Tweet

More Decks by threetreeslight

Other Decks in Technology

Transcript

  1. How to probe prometheus &
    grafana
    What is helm
    @threetreeslight
    on shinjuku mokumoku programming #20
    1 / 19

    View Slide

  2. Who
    VP of Engineering at
    Event Organizer
    おじさん
    Repro
    2 / 19

    View Slide

  3. 今⽇やること
    blog
    監視のgrafana
    において外形監視が落ちるを解決す

    Istio
    のchart
    を基にprometheus
    とgrafana
    の設定⾒直す
    3 / 19

    View Slide

  4. できたこと
    blog
    監視のgrafana
    において外形監視が落ちるを解決
    する
    Istio
    のchart
    を基にprometheus
    とgrafana
    の設定⾒直す
    あわせて
    helm chart
    の構成理解
    istio
    の正常(多分)稼働
    4 / 19

    View Slide

  5. 迷ったこと
    1.
    すでにPrometheus, Grafana
    でcluster
    監視している場
    合、Istio
    に同梱されているchart
    は使わないよね?
    2. istio
    は個別のnamespace
    に分けたほうがつかやすかった
    りするのか?
    3. helm
    を複数のservice account,
    複数のcluster
    で使う場合
    どうするのか?
    5 / 19

    View Slide

  6. せっかくなので
    いくつかtips
    ご紹介
    6 / 19

    View Slide

  7. healthcheck
    Prometheus
    Grafana
    7 / 19

    View Slide

  8. Prometheus helth
    check
    CNCF graduagted project
    のprometheus
    、health
    check endpoint
    実装されてた
    https://github.com/prometheus/prometheus/blob/47a673c3
    router.Get("/-/healthy", func(w http.ResponseWriter, r *http.Request)
    w.WriteHeader(http.StatusOK)
    fmt.Fprintf(w, "Prometheus is Healthy.\n")
    })
    router.Get("/-/ready", readyf(func(w http.ResponseWriter, r *http.Req
    w.WriteHeader(http.StatusOK)
    fmt.Fprintf(w, "Prometheus is Ready.\n")
    }))
    8 / 19

    View Slide

  9. 思ったより?
    揉めずにサクッとはいっていた模様。/-/ready

    先にあったからかな?
    Add /-/healthy and /-/ready endpoints #2831
    9 / 19

    View Slide

  10. Prometheus Probe
    こんな感じ
    シンプルになった
    livenessProbe:
    httpGet:
    path: /-/healthy
    port: 9090
    readinessProbe:
    httpGet:
    path: /-/ready
    port: 9090
    10 / 19

    View Slide

  11. Grafana health check
    で /api/health endpoint
    が提供されて
    いた。
    Grafana 4.3
    https://github.com/grafana/grafana/blob/e78c1b4abc7eda7
    func (hs *HTTPServer) healthHandler(ctx *macaron.Context) {
    notHeadOrGet := ctx.Req.Method != http.MethodGet && ctx.Req.Method !=
    if notHeadOrGet || ctx.Req.URL.Path != "/api/health" {
    return
    }
    data := simplejson.New()
    data.Set("database", "ok")
    data.Set("version", setting.BuildVersion)
    data.Set("commit", setting.BuildCommit)
    11 / 19

    View Slide

  12. ぼちぼちコメントが
    それなりにこまっていたということだろうか?ぼち
    ぼちコメントが有る。
    grafana
    のicon
    が帰ってくるかどうかでwork around
    しているひともいるぐらい。
    アクセスすると認証前だったらlogin
    画⾯に⾶ばされ
    たり、そもそもそのログイン画⾯がちょいと重かっ
    たりするから欲しい気持ちめっちゃわかる。
    Monitoring Grafana #3302
    12 / 19

    View Slide

  13. Grafana Probe
    こんな感じ
    シンプルになった
    readinessProbe:
    httpGet:
    path: /api/health
    port: 3000
    13 / 19

    View Slide

  14. health check
    の仕組み
    が提供されているとよい
    よね
    14 / 19

    View Slide

  15. helm chart
    15 / 19

    View Slide

  16. What is helm
    helm ( )
    とは、CNCF (
    )
    でhosting
    されている
    kubernetes
    上のpackage manager

    https://helm.sh/
    https://www.cncf.io/
    16 / 19

    View Slide

  17. stop the copy-and-
    paste madness.
    この表現がなされるほどのyaml wall
    1. Helm
    は単純にkubernetes
    のresource
    をGo templating

    ているだけ
    2. local
    にchart
    をおいて複数cluster
    に展開することもでき
    るので便利だったりする
    細かい話はblog
    にあげていく
    17 / 19

    View Slide

  18. Tips
    終わり
    18 / 19

    View Slide

  19. 頑張っていく

    19 / 19

    View Slide