When the client hits the app endpoint, the k8s level flow as below:
- clone the repo
git clone -b main https://github.com/saloyiana/devops-tasks
- change dir to
devops-tasks/todo_app
by cddevops-tasks/todo_app/
- run
docker-compose up
- to access the app, go to:
http://localhost:8000/todos/list/
- add your creds to the
platform/k8s-cluster/terraform.tfvars
- run
make cluster up
or
cd platform/k8s-cluster
terraform init
terraform apply -auto-approve
echo "Preparing the namespaces"
kubectl create namespace nginx-ingress
kubectl create namespace argocd
kubectl create namespace kyverno
kubectl create namespace monitoring
kubectl create namespace logging
kubectl create namespace app-test
kubectl create namespace db
kubectl create namespace app-prod
- start installing the tools by running
make tools
orsh tools.sh
- create the db and argocd apps by running
make db argocd-test db argocd-prod
or
echo "Prepare the DB for the APP"
helm repo add bitnami https://charts.bitnami.com/bitnami &&\
helm repo update &&\
helm install postgres -n db --set primary.persistence.enabled=false,global.postgresql.auth.database=postgres,global.postgresql.auth.postgresPassword=postgres,global.postgresql.auth.username=postgres,tls.preferServerCiphers=false,readReplicas.persistence.enabled=false,serviceAccount.automountServiceAccountToken=false bitnami/postgresql --version 12.8.0
kubectl apply -f argocd-objects/repo.yaml -n argocd
kubectl apply -f argocd-objects/test.yaml -n argocd
kubectl apply -f argocd-objects/prod.yaml -n argocd
- there is still need to manage the env secrets, to be improved.
- the database for test and prod need to different, however it is one instance here for demo purposes.
- it is better to have two different repos for app and k8s config.