Ravindra BagaleCourses & study guides मराठी Track your progress

Guides

GitOps क्या है? Beginner Guide और Real Flow

Desired state Git में, सिर्फ PR, sync agent apply, drift detect, rollback = git revert.

Friends, GitOps means the cluster must match Git — not the other way around. Chala mitrano — if you kubectl edit, expect OutOfSync.

Quick answer

Hold this vertical picture:

  1. manifests Git.
  2. PR reviews.
  3. sync agent.
  4. Synced/Healthy.
  5. revert; no clear secrets.

Language: English · मराठी · हिंदी

Commit YAMLDesired state PR reviewHuman gate Merge to mainSource of truth Sync agentApply diff Cluster matchesHealthy
GitOps flow

GitOps क्यों

audit/revert.

Why: snowflake kubectl. What: Git + agent. How: PR ticket.

Example 1: Desired state in Git

Type this:

mkdir -p /tmp/gitops/apps/web && printf '%s\n' 'apiVersion: apps/v1' 'kind: Deployment' 'metadata: {name: web}' 'spec: {replicas: 2}' > /tmp/gitops/apps/web/deploy.yaml && cat /tmp/gitops/apps/web/deploy.yaml

You will see:

apiVersion: apps/v1

What it means: Git holds what should run — not a wiki guess.

Example 2: PR is the change ticket

Type this:

printf '%s\n' 'ok: every image tag bump goes through a pull request review'

You will see:

ok: every image tag bump goes through a pull request review

What it means: No kubectl edit prod in GitOps land.

Example 12: Definition one-liner

Type this:

printf '%s\n' 'GitOps: Git is source of truth; automated sync makes the cluster match'

You will see:

GitOps: Git is source of truth; automated sync makes the cluster match

What it means: Interview opener.

Concept 1: Sync/drift

controller.

Why: manual fight. What: OutOfSync. How: least privilege.

Example 3: Sync agent idea

Type this:

printf '%s\n' 'Controller compares Git desired state to live cluster and applies the diff'

You will see:

Controller compares Git desired state to live cluster and applies the diff

What it means: Argo CD / Flux are common controllers.

Example 4: Drift detection

Type this:

printf '%s\n' 'If someone kubectl-ed a change, GitOps shows OutOfSync and can heal'

You will see:

If someone kubectl-ed a change, GitOps shows OutOfSync and can heal

What it means: Drift is visible — Infosys audit win.

Example 7: Who can apply

Type this:

printf '%s\n' 'Humans merge PRs; the controller applies — least privilege on cluster creds'

You will see:

Humans merge PRs; the controller applies — least privilege on cluster creds

What it means: Fewer humans with prod kubeconfig.

Concept 2: Promote/rollback

merge/revert.

Why: SSH hotfix no history. What: overlays; revert. How: CI tags in Git.

Example 5: Promote via Git

Type this:

printf '%s\n' 'dev overlay → stage → prod folders or branches; merge promotes'

You will see:

dev overlay → stage → prod folders or branches; merge promotes

What it means: Promotion is a merge, not an SSH.

Example 6: Image tag update

Type this:

printf '%s\n' 'sed example: image: registry.example.internal/web:1.4.2'

You will see:

sed example: image: registry.example.internal/web:1.4.2

What it means: CI writes the tag into Git; sync deploys.

Example 8: Rollback = revert commit

Type this:

printf '%s\n' 'git revert the bad tag commit; sync brings old version back'

You will see:

git revert the bad tag commit; sync brings old version back

What it means: History explains every prod change.

Concept 3: Scale/secrets

app-of-apps; sealed.

Why: cleartext fail. What: root app; external. How: TF PR-gated.

Example 9: Not only Kubernetes

Type this:

printf '%s\n' 'GitOps idea also appears for Terraform plans gated by PR — cluster sync is the classic demo'

You will see:

GitOps idea also appears for Terraform plans gated by PR — cluster sync is the classic demo

What it means: Stay focused on K8s sync for this guide.

Example 10: App of apps pattern hint

Type this:

printf '%s\n' 'One root app points at a folder of child apps — team scale pattern'

You will see:

One root app points at a folder of child apps — team scale pattern

What it means: Capgemini multi-team clusters use this.

Example 11: Secrets still special

Type this:

printf '%s\n' 'Do not put raw passwords in Git — sealed secrets / external stores'

You will see:

Do not put raw passwords in Git — sealed secrets / external stores

What it means: GitOps does not mean secrets in cleartext.

GitOps card

1 Git 2 PR 3 sync 4 drift 5 revert 6 no clear secrets

Suppose: OutOfSync

stop manual edits.

Suppose: bad release

revert.

Ravindra Bagale's Tip

At Cognizant and Infosys interviews, say: PR review is the change ticket; the sync agent is the only prod applier.

Check yourself (quiz)

Q1. truth?

Git

Q2. apply?

agent

Q3. ticket?

PR

Q4. rollback?

revert

Q5. kubectl edit?

drift

Q6. secrets?

not cleartext

Reading tracking

Mark this guide when you finish. Your browser remembers it on this device.

commit → PR → sync → match → revert. Did you understand? Let us try it once more.

Frequently asked questions

GitOps vs CI deploy?

CI may update Git; the agent deploys continuously from Git.

Must I use Argo CD?

No — Flux and others exist; Argo is common.

What is drift?

Live cluster differs from Git.

Rollback?

Revert commit; sync.

Secrets?

Sealed secrets / external secret stores.

App of apps?

Root application that manages many child apps.