2.9 KiB
2.9 KiB
\
kub-web-test
Two Git branches, three deployed environments.
Branches
dev— development changes go hereprod— Kargo writes promoted content here
There is deliberately no staging branch.
Sites / Kargo Stages
- DEV —
http://web-dev.max.test.scrumdapp.open-ict.hu - STAGING —
http://web-staging.max.test.scrumdapp.open-ict.hu - PROD —
http://web-prod.max.test.scrumdapp.open-ict.hu
push to dev
|
v
Warehouse
|
v (automatic)
DEV
|
v (manual)
STAGING
|
v (manual)
PROD
|
+--> writes promoted content to prod branch
Staging is pinned by Kargo to the exact commit selected from dev.
Prod permanently tracks the prod branch.
Initial Git setup
git init
git remote add origin https://git.5vl.nl/5vl/kub-web-test.git
git checkout -b dev
git add .
git commit -m "Initial Helm and Kargo setup"
git push -u origin dev
# Seed prod once so Argo CD has something to deploy initially.
git checkout -b prod
git push -u origin prod
git checkout dev
After that, do your normal work on dev.
Bootstrap Kargo project
kubectl apply -f bootstrap/00-kargo-project.yaml
kubectl get namespace web
Kargo Git credentials
Kargo needs write permission because the prod promotion pushes to prod.
Do not commit the real token.
read -s -p "Git token: " GIT_TOKEN
echo
kubectl create secret generic kub-web-test-git \
-n web \
--from-literal=repoURL=https://git.5vl.nl/5vl/kub-web-test.git \
--from-literal=username=5vl \
--from-literal=password="$GIT_TOKEN"
kubectl label secret kub-web-test-git \
-n web \
kargo.akuity.io/cred-type=git
Argo CD repository credentials
If the repository is private:
kubectl create secret generic kub-web-test-repository \
-n argocd \
--from-literal=type=git \
--from-literal=url=https://git.5vl.nl/5vl/kub-web-test.git \
--from-literal=username=5vl \
--from-literal=password="$GIT_TOKEN"
kubectl label secret kub-web-test-repository \
-n argocd \
argocd.argoproj.io/secret-type=repository
Then:
unset GIT_TOKEN
Create Argo CD apps and Kargo pipeline
kubectl apply -f bootstrap/01-argocd-applications.yaml
kubectl apply -f bootstrap/02-kargo-pipeline.yaml
Check:
kubectl get applications -n argocd
kubectl get warehouse -n web
kubectl get stages -n web
kubectl get freight -n web
Test the flow
Make any change on dev:
git checkout dev
# edit something
git add .
git commit -m "Test deployment"
git push
Then:
- Kargo discovers the commit as Freight.
devauto-promotes it.- Check the DEV site.
- Manually promote that Freight to
staging. - Check the STAGING site.
- Manually promote the same Freight to
prod. - Kargo force-updates the
prodbranch to that exact selected revision. - Argo CD syncs the PROD site from
prod.
The three Kubernetes namespaces are:
web-devweb-stagingweb-prod