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

Abstract Helmfile

Abstract Helmfile

Abstraction of Helmfile.
社内LT用に作成したHelmfileの概要資料です/

Junki Mano

July 29, 2019
Tweet

More Decks by Junki Mano

Other Decks in Technology

Transcript

  1. Helmfile
    Future-Daily-Standup-Meeting
    Kubernetes Ecosystem Study
    Mano Junki

    View Slide

  2. What Helmfile?

    View Slide

  3. Helmfileとは
    • KubernetesのパッケージマネージャであるHelmを宣言的に操
    るツール
    • 主な機能
    1. Helm Chart のValuesファイルをバージョン管理
    2. k8sアプリの変更をCI/CD
    3. 継続的に「あるべき状態」に寄せていき、prd/stgなど環境全体の
    skew(ずれ)を抑制する

    View Slide

  4. Helmfileは何を解決するものか

    View Slide

  5. Helmfileは何を解決するものか
    • Helmによってk8sアプリをパッケージ化はできたが、インス
    トール時に指定する設定値によって動作が変わる
    • 設定値の指定方法が、サービスに寄ってまちまちになりがちで、自動
    化が難しかった
    • skew防止
    • 例:デバック用にインセキュアな設定をした。
    • ⇨hemlfileを定期実行することで、書かれていない設定は取り除かれる

    View Slide

  6. こういう環境差分の
    values.yamlなどの管理。
    これをデプロイするshell
    script?
    → Helmfileで代理
    https://medium.com/@naseem_60378/helmfile-its-like-a-helm-for-your-helm-74a908581599

    View Slide

  7. Helmfile Configuration

    View Slide

  8. Helmfile最小構成の例
    • prom-norbac-ubuntuというアプリ名で、stable/prometheus
    のChartでインストール。Chart Valueとして rbac.create=false
    を指定(残りはChartのデフォルト値)。values.yamlの代替

    View Slide

  9. Helmfile設定項目
    以下の3つ
    1. release(前ページで説明したので割愛)
    2. repositories
    3. helmDefaults

    View Slide

  10. repositories
    • name=HelmのChartリポジトリ名
    • url= HelmのChartのリポジトリのURL

    View Slide

  11. helmDefaults
    • tillerNamespace
    • HelmのサーバサイドコンポーネントのTillerインストール先のネームスペース
    • kubeContext
    • kubeconfigのどのcontextが指すk8sクラスタに接続するかの指定
    • args
    • helmfileが呼ぶ全helmコマンドに追加する引数
    • 略

    View Slide

  12. 実行
    • helmfile apply
    • apply all resources from state file only when there are changes
    • ⇨単純な適用
    • helmfile sync
    • sync all resources from state file (repos, releases and chart deps)
    • ⇨定期的にsyncすることで実機との動機が行える

    View Slide

  13. 参考
    • https://github.com/roboll/helmfile
    • https://medium.com/@naseem_60378/helmfile-its-like-a-
    helm-for-your-helm-74a908581599

    View Slide