TNS
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
NEW! Try Stackie AI
CI/CD / DevOps / Operations

Make Your Kubernetes Apps Self-Heal With Argo CD and GitOps

Argo CD makes sure the cluster always matches the desired state. With GitOps, your applications become self-healing and always stay in sync with git.
Dec 10th, 2025 10:00am by
Featued image for: Make Your Kubernetes Apps Self-Heal With Argo CD and GitOps
Image from DHurley on Shutterstock.

Kubernetes applications in production traditionally require manual work and time.

GitOps with Argo CD solves this. It keeps your cluster in sync with git, where your repository defines the desired state. Argo CD makes sure the cluster always matches it, and when something falters, it fixes itself automatically. With GitOps, your applications become self-healing and always stay in sync with git.

What Is GitOps and Self-Healing?

GitOps means your git repository is the single source of truth for everything. When reality doesn’t match git, the system automatically fixes itself.

Your app’s configurations are stored in git, and any changes to either your app or the git source code will automatically be fixed. This is GitOps at its finest and most simple opportunity to accelerate the traditional deployment process.

Rejuvenating Traditional Deployment

When you follow the traditional deployment process, there are many scenarios where things might take an unexpected turn:

  • Someone can manually change the production settings, and your production might halt.
  • A technical misstep on the server can pause production, then you have to manually restart it.
  • Your app configuration changes, and you have to keep track of what was changed.

GitOps handles all these possibilities effectively and with simplicity.

GitOps Self-Healing Solution

With GitOps, you can maintain the current state of your application in a git repository. GitOps tech like Argo CD ensures that whatever is defined in your git matches the actual app deployment.

If there are technical hiccups on the server, GitOps will automatically resolve them and restore your app to the defined state. This is known as self-healing in GitOps.

On top of that, you also keep an audit trail of all the changes made in git.

Step 0: Prerequisites

  • Docker is installed on your system.
  • My go-to: WSL2 with Ubuntu. Feel free to use your own Linux setup.
  • GitHub account.
  • Docker Hub account.
  • My go-to: React project (You can use any project).
  • Knowledge of Kubernetes (optional).

Step 1: Install and Start Minikube

First, set up a Kubernetes cluster. For this tutorial, we will use Minikube. It’s lightweight and ideal for learning.

(You can skip this step if you already have a cluster running locally.)

Install Minikube

Run the commands below to install Minikube:

Start Minikube Cluster

Before running the command below, make sure Docker is running.

Step 2: Create Your React App

Update the App for Demo

Replace src/app.js:


Note: This code should work fine. You can also use Vite or any other framework, since CRA is deprecated.

Create Dockerfile

A Dockerfile is used to write the Docker codebase.

Create Dockerfile:

Make sure to put this file in the root of the project. Paste the code below into it.


Here, we are first installing the node, then creating a build, then following instructions on running the application on port 80.

Push to GitHub

Once all your code is ready, push it to GitHub.

Step 3: Build and Push Docker Image

Now that the code is ready, create a Docker image and push it to Docker Hub.

If you don’t have a Docker Hub account, you can sign up and create one from the Docker Hub page.

Also, make sure Docker is running locally. If you don’t have Docker installed locally, you can install Docker Desktop.

Step 4: Create GitOps Configuration Repository

To get started with GitOps, create a new git repository. This is important because it’s possible to have separate repositories for source code and GitOps.

Create Kubernetes Manifests

First, create a new folder called “app.” Inside this folder, create Kubernetes-related files.

Create app/deployment.yaml:


This is a regular Kubernetes deployment file with basic details. Make sure to update the image with your Docker image.

Next, create another file for the Kubernetes service.

Create app/service.yaml:

Commit GitOps Configuration

Once all the files are created, push the changes to GitHub.

Step 5: Install Argo CD

Next, install the tool that makes self-healing possible.

Access Argo CD


Now Argo CD will run on port 8080. Open this URL in your browser: https://localhost:8080.

You would see a login screen like this:

AgroCD login screen

AgroCD login screen.

You can use the username “admin” and the password that you have just generated using the above command. Once the login is done, it’s time to create an application inside Argo CD.

Step 6: Create Self-Healing Application

Tell Argo CD to manage your app and enable self-healing.

Create Argo CD Application

Create selfhealing-application.yaml:


Apply it:


Once this is done, you should see your application in your Argo CD dashboard.

Argo CD UI showing that it  is running locally

Argo CD UI showing that it is running locally.

Step 7: Access Your Self-Healing App


It should show something like this:

Output showing that pods are running

Output showing that pods are running.



Visit http://localhost:3000 to see your app running.

Initial app with first version

Initial app with first version.

Step 8: Test Self-Healing 

It’s time to test the changes and see the self-healing process in action.

Deleting a Pod

Start by simply deleting a pod.


This is basic Kubernetes behavior, but now let’s see Argo CD’s self-healing …

Delete the Entire Deployment

Now, go one step further by deleting everything.


Argo CD app status, showing sync time and other details

Argo CD app status, showing sync time and other details.

The Argo CD dashboard will show sync time as “a few seconds ago.” This shows that it has already synced and created the application again. In other words, Argo CD ensures reality always matches git.

Step 9: Making Real Updates (The GitOps Way)

Now, make a legitimate change to see how GitOps handles updates.

Update Your App

Edit src/App.js and change:


This update reflects a new version of the app. A simple change.

Build and Push New Version

Now, create a new Docker build and push it to the Docker Hub. Also, push the source code to GitHub.

Update GitOps Configuration

Next, open the GitOps repository and use the update app/deployment.yaml file, updating the image path in the app/deployment.yaml file for the new Docker image.


Next, push changes to the GitOps repo.

Watch Automatic Deployment

Within minutes, Argo CD will:

  1. Notice the git repository changed.
  2. Pull the new configuration.
  3. Update the running application.
  4. Show “Synced” status in the UI.

By default, Argo CD checks for changes every three minutes. You can adjust this to make it check faster (near real time) or slower (less frequent).

Visit http://localhost:3000 to see your updated app.

Make sure to do port forwarding before checking.


Now, you will see the updated UI.

Final app showing self-healed state with new version

Final app showing self-healed state with new version.

This screen means you have completed the GitOps setup. Now your apps will automatically be deployed and heal themselves whenever needed.

Understanding the Self-Healing Magic

Here’s the workflow that makes self-healing possible: 

  1. Argo CD keeps watching the git repository. It also watches your Kubernetes cluster.
  2. It continuously compares the configuration defined in git and the actual Kubernetes structure.
  3. If it finds a difference, it signals Kubernetes to adjust as defined in git.

This is the self-healing process.

Image showing GitOps workflow

Image showing GitOps workflow.

GitOps Is the Future (And Present)

Every time you push to git, your app updates. When production stops, your app heals itself. This is more than deployment automation. It is a self-healing infrastructure. It takes care of itself while giving you back time to work on other things. That’s the power of GitOps.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Real, Docker, Enable.
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.