Continuous integration and continuous delivery (CI/CD) is a very important aspect of DevOps practice. When it comes to the Kubernetes environment, a trend that applies to the practice of CI/CD is called GitOps. GitOps means that Git is the source of truth for the application deployment. In nutshell, GitOPs steps are as follows:
All codes are pushed to a source code repository and versioning system (like GitHub ).
Kubernetes controller object (e.g Flux) monitors the cluster application and ensures that all changes to the repository are pulled down and installed on the cluster.
This means that the cluster state is always up-to-date and in sync with the repo.
Any change pushed to the repository initiates the cycle of reconciliation to ensure that the desired state as reflected in the git repo is the same as the actual state of the cluster
GitOps is summarized in the GitOps principle’s listed below, by the OpenGitOps working group. Here are the 4 GitOps principles.
1. Declarative: A system managed by GitOps must have its desired state expressed declaratively.
2. Versioned and Immutable: The desired state is stored in a way that enforces immutability, and versioning and retains a complete version history.
3. Pulled Automatically: Software agents automatically pull the desired state declarations from the source.
4. Continuously Reconciled: Software agents continuously observe the actual system state and attempt to apply the desired state.
In this video, we deploy our website with Flux. To deploy the website we had to do a couple of things. Firstly, create Flux Bootstrap, secondly, create a source and finally create a kustomization file.