Upgrade to Pro — share decks privately, control downloads, hide ads and more …

一起玩 Helm 3

Johnlin
November 30, 2020

一起玩 Helm 3

Johnlin

November 30, 2020
Tweet

More Decks by Johnlin

Other Decks in Programming

Transcript

  1. Ұى؝ Helm 3
    John Lin (@johnlinvc)

    View full-size slide

  2. ᮫ԙզ
    • John Lin

    • Twitter: @johnlinvc

    • Senior Solution Architect, DevOps

    @ West Pharmaceutical

    View full-size slide

  3. ࣾ܈׆ಈ
    • iplayground.io 2020 Keynote ߨऀ

    • Coscup, RubyConf TW, RubyKaigi, PyCon TW ߨऀ

    • ओ㭎 Swift Taipei Meetup

    View full-size slide

  4. ॄኄੋ Helm ?
    • > Helm is the best way to find, share, and use software built for
    Kubernetes.

    • > Helm helps you manage Kubernetes applications — Helm Charts help
    you define, install, and upgrade even the most complex Kubernetes
    application.

    View full-size slide

  5. Helm ೳ၏ॄኄʁ
    • ҆᧋ Chart

    • ઃఆ Chart

    • Rollback Chart

    • ؐ༗ߋଟ

    View full-size slide

  6. • ؆ᄸိ㘸बੋऔ୅

    • kubectl create -f

    • kubectl edit
    Helm ೳ၏ॄኄʁ

    View full-size slide

  7. ҆᧋
    • HomeBrew: brew install helm

    • Linuxɿcurl https://raw.githubusercontent.com/helm/helm/master/scripts/
    get-helm-3 | bash

    • APT: ༗ᴍຑ൥ɼՄҎ؃׭໢ɻ

    View full-size slide

  8. Helm ໊ࢺղᬶ
    • Chart

    • Repo

    • Config

    • Release

    View full-size slide

  9. Chart
    • Helm త౟݅ᄸҐ

    • 㚎ؚ k8s resource template, default values

    • ՄҎ༗ dependency

    • ૾ੋ rpm, deb తײ᧷

    View full-size slide

  10. Repo
    • ଘ์ Chart త server

    • ओཁ༗ၷݸޭೳɿྻग़ Charts ࿨Լࡌ Chart

    • ౳ಉԙ apt/yum repo

    View full-size slide

  11. Config
    • ์ਐ k8s resource template ཫతᆴɻ

    • Chart ။༗༬ઃᆴɻ

    • ՄҎࡏ㑌ݸ release ཫڅෆಉతᆴɻ

    View full-size slide

  12. Release
    • Ұݸӡߦதత Chartɼ૾ੋ Process తײ᧷ɻ

    • धཁڅଞҰݸ໊ࣈɻ

    • ՄҎ༗኷ଟݸಉ࣌ӡߦʢ Chart ሜಘ޷త࿩ʣ

    View full-size slide

  13. ࢖༻ Helmɼ Ҏ Prometheus ҝྫ
    • Prometheus ੋҰ౟؂߇ܥ౷ɻk8s ཫେྔ࢖༻ɻ

    • https://github.com/prometheus-community/helm-charts/tree/main/charts/
    prometheus


    View full-size slide

  14. Ճೖ Repo
    • ೺ repo Ճೖ local helm ɻṜᒬ࠽ೳፙ౸ chartɻ

    • helm repo add prometheus-community https://prometheus-
    community.github.io/helm-charts

    • helm repo add stable https://charts.helm.sh/stable

    View full-size slide

  15. ҆᧋ Chart
    • ༻ prometheus chart ҆᧋Ұݸ release ໊ҝ demo-promɻ

    • helm install demo-prom prometheus-community/prometheus

    View full-size slide

  16. NOTES.txt
    • 䋯׬ install/upgrade ޙ။ग़ݱత㘸໌ɻ

    • ҰᒬՄҎ༻ templateɻॴҎ௨ৗՄҎ௚઀ෳ੡ష্ɻཫ໘త namespace ྨ
    తҰൠိ㘸౎။ੋሣతɻ

    • export POD_NAME=$(kubectl get pods --namespace default -l
    "app=prometheus,component=server" -o
    jsonpath="{.items[0].metadata.name}")

    • kubectl --namespace default port-forward $POD_NAME 9090

    View full-size slide

  17. Side Topic:HSTS
    • HTTP Strict Transport Security

    • Ұୠ༻ https ࿈աత໢Ҭɼब࠶໵ෆೳ༻ http ྃ...

    • localhost ༗࣌ީҰෆখ৺बෆೳ༻ http ྃ

    • ՄҎ༻ *.vcap.me ႔ཧɻ *.vcap.me Ӭԕ౎။ࢦ޲ 127.0.0.1

    View full-size slide

  18. List release
    • ྻग़ݱࡏ context Լతॴ༗ release

    • Helm list

    View full-size slide

  19. ઃఆ Chart
    • ༗ၷछํࣜ

    • --set key1=val1 (ෆਪનɼ๨ه೭લଧաॄኄबࢮఆྃʣ

    • --values values.yaml ( ՄҎ commit ਐ git )

    View full-size slide

  20. ઃఆ Chart
    • values.yaml

    server:
    statefulSet:
    enabled: true

    View full-size slide

  21. ߋ৽ Chart
    • helm upgrade demo-prom prometheus-community/prometheus -f
    values.yaml

    View full-size slide

  22. List Release History
    • ྻग़ release త㑖࢙ل㑚ɻ

    • helm history demo-prom

    View full-size slide

  23. Rollback Release
    • Rollback release ౸೭લత൛ຊɼแؚ config, chart ൛ຊɻ

    • helm rollback demo-prom 1

    • helm history demo-prom

    View full-size slide

  24. ႟আ release
    • helm uninstall demo-prom

    View full-size slide

  25. ৗݟత޵
    • ߋ৽ޙࣗಈੜ੒తີᛰᏓྃɿՄҎࡏ release secret ཫፙ౸ᢜతᆴɼઃఆਐ
    ჩᏐཫ೭ޙबෆ။Ꮣྃɻ

    • ৽తઃఆᔒ༗ੜᏈɿChart ᔒ༗ਖ਼֬ઃఆ Deployment/Statefulset/
    DaemonSet తߋ৽ᑍ݅ɻधཁखಈࣥߦ kubectl rollout restartɻ

    View full-size slide

  26. Helm 2 vs Helm 3
    • ᔒ༗ Tiller ɼෆधཁࡏ K8S Cluster ཫ᧋౦੢ྃɻ

    • औফ౷Ұ Repoɼվҝ෼ࢄࣜɻՄҎ༻ https://artifacthub.io ፙ Chartɻ

    • ࢦྩ໊᜝᜗ඍվᏓɻ fetch -> pullɻ౳౳ɻ

    • ࢧԉ࢖༻ OCI registry ိଘ์ Chart

    View full-size slide

  27. Helm 2 end of support
    • Tiller image Մೳᬋ࣌။׵஍ํଘ์ɻ

    • Helm 2 client Մೳ໵။׵஍ํɼෆա get.helm.sh ။ಈɻ

    • Stable chart repo https://github.com/helm/charts 

    ࡏ Nov 13, 2020 ਖ਼ࣜऴࢭࢧԉྃɻ

    View full-size slide

  28. Helm vs Others
    • Kustomize

    • Operator

    View full-size slide

  29. Helm vs Kustomize
    • Template vs Overlay(Patching)

    • Rollback

    • Helm ՄҎࡏ post rendering hook ཫ໘ݺڣ Kustomize

    • https://github.com/thomastaylor312/advanced-helm-demos/tree/master/
    post-render

    View full-size slide

  30. Helm vs Operator
    • Day 1 (Helm) vs Day 2(Operator)

    • ޓิɼhelm ෛ੹҆᧋ ɼ Operator ෛ੹ӡ࡞ɻ

    • ՄҎ༻ helm chart ိ෦ॺ Operator

    • https://sdk.operatorframework.io/docs/building-operators/helm/
    quickstart/

    View full-size slide

  31. መ຿
    • ෆཁ௚઀༻ chart ɼఆٛࣗݾత chart ɼ࠶೺֎෦త chart ఆٛҝ
    dependencyɻᙛ࢖༻ configmap/secret ိ၏ઃఆ࣌࠽ํศɻ

    • ࢖༻ helmfile + helm secrets plugin ိ၏ GitOpsɼ೺Ұ੾౎ଘ์ࡏ Git ཫɻ

    • ળ༻ helm త plugin ܥ౷ɼՄҎఏڙڐଟֹ֎తޭೳɻ

    View full-size slide

  32. ະ׬଴᠃
    • ։ᚙࣗݾత Helm Chart

    • ࢖༻ helmfile

    • ։ᚙࣗݾత Helm Plugin

    View full-size slide

  33. Q&A
    • Twitter: @johnlinvc

    • ౤Өยࡏ 

    https://bit.ly/39pcPiM

    • We're hiring DevOps @ West Pharma, 

    Deploying to hybrid cloud with K8Sɻ

    View full-size slide