Apinizer and Version Management with ArgoCD
Argo CD is an open source GitOps Continuous Deployment tool developed for Kubernetes environments and has an architecture based on the Single Source of Truth model, the cornerstone of GitOps.
Argo CD periodically monitors applications deployed to Kubernetes and compares them against yaml files in the git repository. When it detects any changes, it automatically synchronizes.
1) ArgoCD Installation
This step explains how to install ArgoCD on Kubernetes Cluster. Create argocd as namespace and install ArgoCD on kubernetes using github repository.
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
watch kubectl get pods -n argocd
To provide access to the ArgoCD interface, the service type is configured as Node Port service using the patch command.
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
kubectl get svc argocd-server -n argocd
To access the ArgoCD interface, you can access it using the port address that your service exposes.
http://<KUBERNETES_WORKER_IP_ADDRESS>:<PORT>
To access ArgoCD's interface, you can decode the base64 encoded password and view your password using the following command.
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
Default Username is admin user. You can login to the ArgoCD interface using this information.
2) Git Installation
This step explains how to install git and push the deployment files to your github address.
The example is implemented using Apinizer Manager Deployment.
sudo apt update
sudo apt install git
git --version
Very Important
Git sizden bu bilgileri isteyebilir.
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Create a repo on github to keep your deployment files.
To add files to the github repo, add it as a remote address to the git system.
You can use a token to add it as a remote address, how to do this is explained in detail in the warning area below.
Very Important
If you get an “Authentication failed” error when using git. Follow these steps
- Log in to your GitHub account.
- Click on your profile picture in the top right corner and select “Settings”.
- In the left menu, under “Developer settings” go to “Personal access tokens”.
- Click on “Token” and then “Generate new token”.
- Grant the necessary permissions.
- Scroll to the bottom of the page and click on the “Generate token” button.
Copy the token value and save it in a safe place. You cannot view this value again.
git remote set-url origin https://<USERNAME>:<ACCESS_TOKEN>@<REPO_ADDRESS>
Örnek: https://test:ghp_xxxx@github.com/test/test.git
Add Apinizer's manager yaml file to git version system and push it to your remote repo.
git init
git add apinizer-api-manager-deployment.yaml
git commit -m "manager add"
git remote add origin <GITHUB_REPO_ADDRESS>
git push -u origin master
After adding the yaml files on Github, you can continue with the rest of the steps from the ArgoCD interface.
3) Adding Git Repository to ArgoCD
After adding the yaml file to the github repository, this repo address should be added from the ArgoCD interface.
There are many ways to connect. These fields must be filled in for the HTTPS method.
Very Important
If HTTPS is selected as the connection method, enter the token value you created in the previous step in the password section.
4) ArgoCD Application Creation
A name is given for the application. If you want ArgoCD to automatically check if there are any updates in the repository, you can set the SYNC POLICY option to Automatic.
ArgoCD will then check for you every 3 minutes.
When you need a previously uncreated namespace in your Kubernetes Cluster, ArgoCD will create a namespace in your kubernetes cluster with the AUTO-CREATE NAMESPACE option.
ArgoCD will show you deployment, replica set and pods. In the example image below, we can see the instant log data of the pod.
You can manually make a change in your yaml file by pressing the SYNC button.
ArgoCD automatically detects every change made in YAML files, updates your pods and allows you to automate your deployment processes for you.
With this automation, you can prevent manual interventions and errors while your deployment processes are more efficient and faster.