Config management for
Kubernetes: GitOps + Helm
Tomasz Tarczyński, Gigaset
Agenda
@ttarczynski
1. Configuration Management
2. Why GitOps
3. Demo: Flux
4. Demo: Helm
5. Demo: Flux Helm Operator
Configuration Management
@ttarczynski
● Infrastructure as a Code
● GIT – as a single source of truth
● Tools:
Ansible / Chef / Puppet / Salt
Puppet
@ttarczynski
● Declarative: describe the desired state
● Modules: public and private
● Templates: ERB
● DSL: a simple and constrained language
● Code / data separation: Hiera
Kubernetes
@ttarczynski
● Control plane provides a Declarative API
● Declare the desired state
● Control plane makes sure that the actual
state converges to the desired state
Kubernetes: Why GitOps
@ttarczynski
● Can we declare all the state in GIT?
And expect the system to converge.
Kubernetes: Why GitOps
@ttarczynski
● Can we declare all the state in GIT?
And expect the system to converge.
○ Track history
Kubernetes: Why GitOps
@ttarczynski
● Can we declare all the state in GIT?
And expect the system to converge.
○ Track history
○ Easy rollback
Kubernetes: Why GitOps
@ttarczynski
● Can we declare all the state in GIT?
And expect the system to converge.
○ Track history
○ Easy rollback
○ Disaster Recovery
Kubernetes: Why GitOps
@ttarczynski
● Configuration Management:
Declarative vs Imperative
GitOps: How
@ttarczynski
Kubernetes
API
push
container images
kubectl apply
pull
GitOps: How
@ttarczynski
● Flux CD: a GitOps operator
○ Runs in the cluster
○ Synchronizes the cluster state with a GIT repo
○ CNCF sandbox project
GitOps: How
@ttarczynski
Kubernetes
API
push
container images
kubectl apply
pull
GitOps: How
@ttarczynski
Kubernetes
API
Flux CD
push
container images
commit
kubectl apply
sync
pull
images metadata
apply / delete
GitOps
@ttarczynski
Demo
https://github.com/ttarczynski/gitops-demo
GitOps: Why Helm
@ttarczynski
● We declared all the state in GIT
● But can we have something like modules?
GitOps: Why Helm
@ttarczynski
● Helm: The package manager for Kubernetes
○ find, share, and use software built for Kubernetes
GitOps: Why Helm
@ttarczynski
● Manage complexity: describe complex apps
GitOps: Why Helm
@ttarczynski
● Manage complexity: describe complex apps
● Easy updates: in-place upgrades and custom hooks
GitOps: Why Helm
@ttarczynski
● Manage complexity: describe complex apps
● Easy updates: in-place upgrades and custom hooks
● Simple sharing: public / private repo
GitOps: Why Helm
@ttarczynski
● Manage complexity: describe complex apps
● Easy updates: in-place upgrades and custom hooks
● Simple sharing: public / private repo
● Rollbacks: roll back to an older version with ease
Helm
@ttarczynski
Demo
https://github.com/ttarczynski/gitops-demo
GitOps + Helm
@ttarczynski
● Flux Helm Operator:
○ automates Helm Chart releases
○ Kubernetes custom resource named HelmRelease
○ charts are released as specified in HelmRelease
GitOps + Helm
@ttarczynski
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
spec:
releaseName: demo
chart:
git: git@github.com:ttarczynski/gitops-demo.git
path: charts/demo
values:
…
Credit: https://fluxcd.io
GitOps + Helm
GitOps + Helm
@ttarczynski
Demo
https://github.com/ttarczynski/gitops-demo
GitOps
@ttarczynski
● The entire system is described declaratively
● The canonical desired system state is
versioned (with Git)
● Approved changes to the desired state are
automatically applied to the system
● Software agents ensure correctness
GitOps
@ttarczynski
● Declarative:
● Modules:
● Templates:
● DSL / general-purpose language:
● Code / data separation:
GitOps
@ttarczynski
● Declarative: k8s + Flux CD
● Modules:
● Templates:
● DSL / general-purpose language:
● Code / data separation:
GitOps
@ttarczynski
● Declarative: k8s + Flux CD
● Modules: Helm charts
● Templates:
● DSL / general-purpose language:
● Code / data separation:
GitOps
@ttarczynski
● Declarative: k8s + Flux CD
● Modules: Helm charts
● Templates: Helm / Go template
● DSL / general-purpose language:
● Code / data separation:
GitOps
@ttarczynski
● Declarative: k8s + Flux CD
● Modules: Helm charts
● Templates: Helm / Go template
● DSL / general-purpose language:
● Code / data separation:
GitOps
@ttarczynski
● Declarative: k8s + Flux CD
● Modules: Helm charts
● Templates: Helm / Go template
● DSL / general-purpose language:
● Code / data separation: kustomize ?
Agenda
@ttarczynski
1. Configuration Management
2. Why GitOps
3. Demo: Flux
4. Demo: Helm
5. Demo: Flux Helm Operator
GitOps: Flux docs
@ttarczynski
● fluxcd.io
● docs.fluxcd.io
● github.com/fluxcd/helm-operator-get-started
● github.com/ttarczynski/gitops-demo
Thanks!
Tomasz Tarczynski
@ttarczynski
Frequently Asked Questions
@ttarczynski
● How to manage secrets?
Frequently Asked Questions
@ttarczynski
● How to manage secrets?
○ github.com/bitnami-labs/sealed-secrets
○ github.com/mozilla/sops
○ git-secret.io
○ HashiCorp Vault
Frequently Asked Questions
@ttarczynski
● How to manage multiple environments?
Frequently Asked Questions
@ttarczynski
● How to manage multiple environments?
○ Branch-per-environment
○ Directory-per-environment
○ Kustomize overlays
○ github.com/fluxcd/flux/issues/1071
Frequently Asked Questions
@ttarczynski
● What version of Helm is supported?
Frequently Asked Questions
@ttarczynski
● What version of Helm is supported?
○ Both:
Helm v2 – GA
Helm v3 – beta (in Helm Operator)

Config management for_kubernetes: GitOps + Helm (CfgMgmtCamp 2020)