GITOps64 is a working implementation of the GITOps methodology, intended to serve as a boilerplate for automated Kubernetes Application deployment projects. The main purpose is to provide ready-to-use deployment modules for popular Kubernetes tools.
- DR01: separate CICD code from module code
- DR02: support both dev-time and run-time data and code
- DR03: use Infrastructure-as-Code (IaC) as much as possible
- DR04: support multiple IaC and not IaC tools
- DR05: keep code, configuration and run-time separated
- DR06: use environments to allow multiple instances of configuration and run-time for the same module code
- DR07: use profiles for code and configuration to allow multiple personalities for the same module
- DR08: use dedicated git repositories for module code as much as possible, for cases where the IaC tools supports remote modules
- DR09: keep the main branch stable (trunk branching strategy)
- DR09: do not use long-lived branches except for release ones
- DR10: group IaC tool code by module
bin
: continuous integration, repository, development scriptsdata
: location for persistent data filesdocs
: application deployment documentationetc
: deployment configurationlib
: location for temporary development time libraries (excluded from GIT)src
: deployment source code (Bash, Kustomization, etc)test
: test scripts for deployment modulestmp
: location for temporary content (excluded from GIT)var
: location for persistent runtime data (included in GIT)vault
: location for runtime secrets (excluded from GIT)
Modules are organized based by type:
- kubernetes: optional kubernetes components and APIs (e.g.: metrics-server, etc.)
- infrastructure: infrastructure providing services to applications (e.g.: cert-manager, sealed-secrets, etc.)
- applications: end-user applications
- resources: non-application objects consumed by application and infrastructure (e.g.: certificates, storage, etc/)
- 'etc/ENVIROMENT/MODULE_TYPE/MODULE_NAME/IAC_TOOL/PROFILE'
- 'src/MODULE_TYPE/MODULE_NAME/IAC_TOOL/PROFILE'
Use the following procedure to deploy GitOps64 for testing purposes on a Minikube cluster and forked GitHub repository.
- Virtualization
- Docker and/or KVM
- Tools
- GIT
- Bash
- Curl
- YamlQuery (yq)
- (*) GitHub CLI
- Kubernetes
- KubeCTL
- Minikube or Kind
- Helm CLI
- GitOps
- (*) FluxCD or ArgoCD CLI
Tools marked with (*) are not needed locally if using the lab container (dev-lab-kind
)
- Upstream repository: used to create and maintain the main GITOps repository
- Kubernetes cluster: target cluster that will be managed by GitOps
-
Fork this repository to your GitHub account
-
Clone the forked repository to your workstation
git clone <FORKED_REPOSITORY> cd gitops64
-
Initialize dev time resources
./bin/dev-lib-local && ./bin/dev-lib-base
-
Review and update dev-environment configuration as needed:
etc/<ENVIRONMENT>
, in particular values marked with replacement tagsX_..._X
-
Review and update enabled modules:
var/<ENVIRONMENT>
: -
Create dev/test kubernetes cluster
- Using Minikube
./src/kubernetes/minikube/bl64/default/main -e dev -p kvm-medium -c && ./src/kubernetes/minikube/bl64/default/main -e dev -p kvm-medium -s
-
Using Kind
./src/kubernetes/kind/bl64/default/main -e dev -p medium -c &&
./src/kubernetes/kind/bl64/default/main -e dev -p medium -s
- (optional) Open lab container environment for running gitops tasks
./bin/dev-lab-kind
-
Setup private GitHub repository access
./src/infrastructure/github/bl64/default/main -e dev -l && ./src/infrastructure/github/bl64/default/main -e dev -a
-
Deploy GitOps service to Kubernetes
- Using ArgoCD:
./src/infrastructure/argocd/bl64/default/main -e dev -p nodeport -c && ./src/infrastructure/argocd/bl64/default/main -e dev -p nodeport -l && ./src/infrastructure/argocd/bl64/default/main -e dev -p nodeport -k
-
Using FluxCD:
- Remove the following line from .
gitignore
:var/fluxcd/*/flux-system
- Deploy FluxCD:
./src/infrastructure/fluxcd/bl64/default/main -e dev -p github -c
- Remove the following line from .
-
(optional) Start NGINX to proxy MetalLB. This will allow local connections from the workstation to exposed cluster services of LoadBalancer type
./src/infrastructure/nginx/bl64/default/main -e dev -p k8s -c
Use to stop and remove the NGIX container
./src/infrastructure/nginx/bl64/default/main -e dev -p k8s -d
Use to stop and destroy the cluster and deployed applications
./src/kubernetes/kind/bl64/default/main -e dev -p medium -d
Help on implementing new features and maintaining the code base is welcomed.