This project creates a local CICD environment for Kubernetes, using the GitOps paradigm: everything should be under version control, including k8s and ArgoCD install steps and configuration.
Having a local CICD environment is much faster and practical than having to push to some external server to only then find out if the tests passed or not.
-
Ansible
-
Docker
This will install pip requirements, k3d, and argocd in localhost:
ansible-playbook install_tools_localhost.yml
This will install the basic resources in k8s:
ansible-playbook bootstrap_k8s.yml
It will:
-
Optionaly install a pull through registry cache in docker, but outside k8s
-
Install a local k8s cluster using k3d.
-
Overwrite the local .kube/conf
-
Export the local k8s_gitops_localdev repository in the cluster, creating a read-only git server
-
Install ArgoCD in the cluster
-
Make ArgoCD watch the local repo
Hereafter, any application to be installed in k8s should be added by modifying the local repo, particularly the argocd-apps/argocd-apps folder.
-
Create a new ArgoCD application file in argocd-apps/argocd-apps. selfreference.yml can be used as an example.
-
Commit the change in the local repo (no need to push to github).
-
Auto-refresh occurs every 3 minutes. To trigger it manually, you have to use
kubectl port-forward svc/argocd-server -n argocd 8080:443
,argocd login localhost:8080
, andargocd app sync argocd-apps
. The user is 'admin' and the password is the name of the argocd-server pod.
TODO: include some sample CI workflows