Thuta Learning
ProjectsDevOpsintermediate

Project — GitOps-Lite Deploy Flow

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand Project — GitOps-Lite Deploy Flow without any of the intimidation
  • Get comfortable running the kubectl commands/YAML yourself
  • Apply this concept right away in a real project

Let's think about it this way for a moment

The core idea of GitOps is that the git repository should be the single source of truth for the desired state — the cluster's actual state is kept constantly in sync with the YAML in git. If you don't have time yet to install/set up a full GitOps tool (ArgoCD, Flux), you can simulate a basic version with a simple script: a pipeline that clones/pulls the git repository and then runs `kubectl apply -f .`. Understanding this concept gives you a solid foundation for learning tools like ArgoCD/Flux later on.

Let's connect this to a real scenario

Create a `k8s/` folder in your git repository and commit all your deployment/service YAML files into it. When you need to change something, don't edit it directly with `kubectl edit` or through a dashboard — instead, edit the file in git, commit/push it, and then run `kubectl apply -f k8s/` (or let a CI/CD pipeline auto-apply it). This gives you a history/audit trail, and you can roll back cleanly with `git revert`.

Let's look at it together

bash
# Set up a k8s/ folder in your git repo
mkdir k8s
git add k8s/*.yaml
git commit -m "Add web-deployment manifests"
git push

# "Deploy" step — apply everything from the folder
kubectl apply -f k8s/

# Made a mistake? Revert the git commit, then re-apply
git revert HEAD
kubectl apply -f k8s/
You should see
$ git log --oneline k8s/
a1b2c3d Add web-deployment manifests

$ kubectl apply -f k8s/
deployment.apps/web-deployment configured
service/web-service unchanged

5-minute try-it

Commit two or three deployment/service YAML files into a `k8s/` folder, then deliberately commit a mistake (say, a wrong image tag) — fix it with `git revert` and run `kubectl apply` again.

A quick word of caution

This project shows the GitOps concept at its most 'basic' — in production you'd use a tool like ArgoCD/Flux, which brings in auto-sync, drift detection, secret encryption, and more.

Easy traps

  • Editing the cluster directly with a manual `kubectl edit` instead of syncing from the YAML in git — this causes the cluster state and the git state to drift apart ('config drift')
  • Committing a Secret (password) as plain text into the git repository — in the GitOps world, Secrets need to be encrypted (sealed-secrets, SOPS)

Now try it yourself

Commit two or three deployment/service YAML files into a `k8s/` folder, then deliberately commit a mistake (say, a wrong image tag) — fix it with `git revert` and run `kubectl apply` again.

You'll know it worked when: $ git log --oneline k8s/ a1b2c3d Add web-deployment manifests $ kubectl apply -f k8s/ deployment.apps/web-deployment configured service/web-service unchanged

Project — GitOps-Lite Deploy Flow | Thuta Learning