Feedback

Chat Icon

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Stand Up the Lab: Two Servers, a Cluster, and an App to Deploy
26%

The Repository

We need to store our code in a Git repository. We will use GitLab for this purpose.

You need a GitLab account to follow this guide. Create a new account or log in to your existing account. After logging in, create a new group to store your projects, and a new project. You can use learning as the name of the group and todo as the name of the project. We are not going to use or add any specific settings, templates, README file, or licenses for this project. Just an empty repository.

After creating the project, GitLab will generate a URL for it. For example:

https://gitlab.com/learning9042634/todo

Where learning9042634 is your group name and todo is your project name. Export both as environment variables and save them in your .bashrc.

Example:

cat << EOF >> $HOME/.bashrc && source $HOME/.bashrc
export GITLAB_GROUP="learning9042634"
export GITLAB_PROJECT="todo"
EOF

Add .git to the end of the URL to get the Git URL, and export it as an environment variable. Example:

cat << EOF >> $HOME/.bashrc && source $HOME/.bashrc
export GITLAB_URL="https://gitlab.com/$GITLAB_GROUP/$GITLAB_PROJECT.git"
EOF

Other variables you need to export are the username and email you used to create the GitLab account:

cat << EOF >> $HOME/.bashrc && source $HOME/.bashrc
export GITLAB_USERNAME=""
export GITLAB_EMAIL=""
EOF

Make sure to change and to your actual GitLab username and email.

Let's push the code to the GitLab repository. First, install Git:

apt update; apt install -y git

Initialize a new Git repository in the todo application directory:

cd $HOME/todo/app
git init --initial-branch=main

Add the global Git configuration:

git config --global user.name "$GITLAB_USERNAME"
git config --global user.email "$GITLAB_EMAIL"

Add the remote repository:

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Enroll now to unlock all content and receive all future updates for free.