Python Flask web application based on a microservice. Docker, GithubAction ,Kubernetes,ArgoCD(CI/CD)
Step 1: Creating the docker images and taging it: Docker for Application Packaging
docker login
docker build -t techtrends .
docker run -dp 7111:3111 techtrends
f125c84d1bc0c6805cfe4d6fdb50999873ebd4faaf0f4f580ac46dcd6e5047de
docker logs
Put the output from the logs
docker tag techtrends yourrepo/techtrends:v1.0.0
docker push yourrepo/techtrends:v1.0.0
docker tag local-image:tagname new-repo:tagname docker push new-repo:tagname
Step 2: Github actions: Continuous Integration with Github Actions
1. Create a new repo
2. push your codes to the new repo
3. Add the docker token and GitHub encrypted secrets from the project directory Goto settings
> secret
> Actions
> click New repository secret
4. create the techtrends-dockerhub.yml
in the .github/workflows/
Might be created automatically when creating the github action.
5. Goto Github Actions
and click on the create a new workflow yourself
button
Step 3: Kubernetetes Declarative Manifests
Make sure your oracle VM Box is open
vagrant up
Note: this command uses the .vagrant folder to identify the details of the vagrant box, you can ls to make sure it is included
vagrant ssh
curl -sfL https://get.k3s.io | sh -
sudo su
kubectl get no
- make a new file called namespace.yaml and vim into it to add your files
- run below codes
touch namespace.yaml
touch deploy.yaml
vim deploy.yaml
touch service.yaml
vim service.yaml
kubectl apply -f namespace.yaml
kubectl apply -f deploy.yaml
kubectl apply -f service.yaml
kubectl delete -f namespace.yaml
Get all Kubectl namespace
kubectl get all -n sandbox
Gett all running pods
kubectl get po -A
Step 4: Helm Charts
- create the folder templates/ and add all requires files.
- create the chart.yaml, values.yaml etc
Step 5: Continuous Delivery with ArgoCD
- install AgroCD in your VM Box
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Note: AFter running the command, you need to wait for sometime to get the container running after which you can continue
kubectl get po -n argocd
kubectl get svc -n argocd
Now we need to expose it to the internet
First, you need to get the argocd-server from the list of service
and copy the yaml argocd-server-nodeport.yaml
from here https://github.com/udacity/nd064_course_1/blob/main/solutions/argocd/argocd-server-nodeport.yaml
touch argocd-server-nodeport.yaml vim argocd-server-nodeport.yaml kubectl apply -f argocd-server-nodeport.yaml
kubectl get svc -n argocd
again
then access the ArgoCD UI by going to https://192.168.50.4:30008 or http://192.168.50.4:30007
To login to argocd
username: admin
password: run command kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
generated password: MPxL7340G95KVVru
kubectl describe po -n sandbox
touch helm-techtrends-staging.yaml
vim helm-techtrends-staging.yaml
touch helm-techtrends-prod.yaml
vim helm-techtrends-prod.yaml
kubectl apply -f helm-techtrends-staging.yaml
kubectl apply -f helm-techtrends-prod.yaml
``