GitOps est une combinaison de bonnes pratiques pour automatiser le déploiement de conteneurs et d'infrastructures. Au lieu de manipuler des changements de configuration en les poussant activement, ici les systèmes synchronisent leurs états automatiquement par rapport à un référentiel contrôlé. À travers de ce workshop, vous découvrirez comment mettre en œuvre cette méthode pour gérer automatiquement des clusters Kubernetes avec l'outil Flux qui vient récemment de sortir en version 2.
6. Gérez vos clusters Kubernetes avec Flux 2 et la méthode GitOps– V°001| 10 novembre 2021
What is GitOps ?
● Way of implementing Continuous Deployment for cloud native
applications
● The desired state of the infrastructure is described in a declarative way
in Git repository
● An automated process makes the environment match the described
state in the repository.
● Git repository as the central element of GitOps
6
8. Benefits of
GitOps
● History of how the environment
changed over time
● Roll back
● Complete description of what is
deployed
● Git Repository is the central
element
9. Benefits of
GitOps
● Reduce the number of tools used :
Git Repository is the central
element
● History of how the environment
changed over time
● Roll back
● Manage deployments from inside
your environment
● Complete description of what is
deployed
12. Push Strategy
➔ A third party pushes new ressources to the
cluster
➔ You need credentials to access the cluster
➔ It’s hard to check for drifts in the cluster
13. Pull Strategy
➔ An operator in the cluster checks the Git
repository at a regular interval
➔ Automated
➔ Overwrites manual changes
➔ Works with container registries
14. How it works ?
➔ Updating application trigger a build
pipeline
➔ A container image is build
➔ The environment configuration repository is
updated
➔ Deployment pipeline is triggered
15. Keep in mind
➔ The CI/CD deployment tools have to know
the necessary credentials to deploy.
➔ Drifts between the state of the environment
and the desired state can not be noticed
automatically
17. How it works
➔ An operator continuously comparing the
desired state of the infrastructure with the
actual state
➔ If differences are noticed, the operator
updates the infrastructure to match the
desired state described in the Git repository
➔ A container registry can be monitored to
find new versions of images to deploy
23. Gérez vos clusters Kubernetes avec Flux 2 et la méthode GitOps– V°001| 10 novembre 2021
Sources
● May be shared by multiple consumers
● Checked for changes on a defined interval
● Specified as Custom Resources in a Kubernetes cluster
● Sources are an artifact consumed by other Flux components
23
24. Gérez vos clusters Kubernetes avec Flux 2 et la méthode GitOps– V°001| 10 novembre 2021
Sources
● Origin of repository containing the desired state and requirements
● May be shared by multiple consumers
● Checked for changes on a defined interval
● Specified as Custom Resources in a Kubernetes cluster
● Sources produce an artifact that is consumed by other Flux
components to perform actions
24
26. Reconciliation
➔ Mechanism of keeping the system matches
the desired state.
➔ Reconciliation runs by default every minute
➔ The reconciliation interval can be
customized
28. Gérez vos clusters Kubernetes avec Flux 2 et la méthode GitOps– V°001| 10 novembre 2021
Kustomization
● Custom resource
● Local set of Kubernetes resources that Flux reconcile
● Two kustomization types :
○ kustomization.kustomize.toolkit.fluxcd.io
○ kustomization.kustomize.config.k8s.io
28
29. Gérez vos clusters Kubernetes avec Flux 2 et la méthode GitOps– V°001| 10 novembre 2021
kustomization.kustomize.toolkit.fluxcd.io
● Kubernetes custom resource
● refers to a kustomization.yaml file path inside a Git
repository or Bucket source.
29
30. Gérez vos clusters Kubernetes avec Flux 2 et la méthode GitOps– V°001| 10 novembre 2021
kustomization.kustomize.config.k8s.io
● Used to configure kustomize overlay
● Tool used to customize Kubernetes objects in a
template-free way. It provides several features that
allow us to customize the application’s configuration.
30
32. Bootstrap
● Process of installing Flux
components
● Everything happens in the version
control used for the application
● Two ways to do bootstrap :
○ using Flux CLI
○ using Terraform provider
33. Bootstrap
● Process of installing Flux
components
● Everything happens in the version
control used for the application
● Two ways to do bootstrap :
○ using Flux CLI
○ using Terraform provider
● The bootstrap is idempotent