GitOps Questions with Answers

14 practice questions on GitOps (DevOps & Kubernetes) with answers and step-by-step solutions. Try 10 samples below, then practise all 14 free in the AptiNest app.

Sample questions

Question 1Easy

How is a bad change usually rolled back in GitOps?

  1. Rebuild every image from scratch and redeploy all services, since Git cannot undo deployments
  2. Delete the cluster
  3. Revert the commit in Git; the agent applies it
  4. SSH into nodes and edit files

Answer: C. Revert the commit in Git; the agent applies it

Explanation

Rollback is a normal Git operation, giving an audit trail.

Step-by-step solution

  1. In GitOps, Git is the source of truth.
  2. You revert the commit.
  3. The agent syncs the cluster back.

Why the other options are wrong

  • A. Rebuilding everything is not needed.
  • B. Deleting is destructive.
  • D. Manual edits cause drift.

Tip: Rollback = git revert.

Question 2Easy

GitOps means:

  1. Developers use Git for code only
  2. Git is the source of truth for desired state, synced to the cluster
  3. Each Git commit is deployed by hand over SSH by the operator who reviewed the pull request
  4. Operations staff never use Git

Answer: B. Git is the source of truth for desired state, synced to the cluster

Explanation

Declarative configs in Git are applied by automation, so every change is reviewed and versioned.

Step-by-step solution

  1. GitOps uses Git as the source of truth for the desired state.
  2. An agent or pipeline syncs that state to the cluster.
  3. Option B says this, so it is correct.

Why the other options are wrong

  • A. GitOps applies Git to infrastructure and deployment, not only to code.
  • C. Manual SSH deploys are the opposite of GitOps.
  • D. Operations staff are central to GitOps workflows.

Tip: In GitOps, Git holds the desired state and automation makes the cluster match it.

Question 3Easy

Which property is central to GitOps?

  1. Declarative desired state
  2. Imperative shell scripts run by hand
  3. Manual approval by email
  4. Mutable servers updated in place

Answer: A. Declarative desired state

Explanation

Declarative configs describe what should exist, which agents can compare and reconcile.

Step-by-step solution

  1. GitOps relies on describing what should exist, not the steps to get there.
  2. Agents compare the declared state with the live state and reconcile them.
  3. Declarative desired state is the central property. Option A is correct.

Why the other options are wrong

  • B. Hand-run shell scripts are imperative and are not GitOps.
  • C. Manual approval by email is not part of the GitOps idea.
  • D. Mutable servers updated in place are the opposite of declarative state.

Tip: Declarative means describing the end state; imperative means listing the steps.

Question 4Easy

What does 'reconciliation' mean for a GitOps agent?

  1. Deleting unused images
  2. Merging two Git branches
  3. Repeatedly making the cluster match Git
  4. Balancing traffic between clusters

Answer: C. Repeatedly making the cluster match Git

Explanation

The agent runs a loop comparing desired and live state and correcting differences.

Step-by-step solution

  1. GitOps agents continuously check cluster state against Git.
  2. They correct any differences to match the desired state.
  3. This process is called reconciliation in GitOps.
  4. Reconciliation ensures the cluster matches Git exactly.
  5. Final answer: Repeatedly making the cluster match Git.

Why the other options are wrong

  • A. Unused images are removed by cleanup jobs, not by a GitOps reconciliation loop.
  • B. Merging branches is a Git action; reconciliation is about making cluster state match Git.
  • D. Traffic balancing is done by load balancers or meshes, not by reconciliation.

Tip: Remember, reconciliation means aligning reality with Git.

Question 5Medium

Tools such as Argo CD and Flux typically work in which mode?

  1. Pull: an in-cluster agent pulls and applies changes from Git
  2. Batch: all changes in Git are collected and applied together once a month in a maintenance window
  3. Manual: an operator applies each YAML file
  4. Push: developers' laptops push changes to the cluster

Answer: A. Pull: an in-cluster agent pulls and applies changes from Git

Explanation

The agent continuously compares cluster state with Git and reconciles differences.

Step-by-step solution

  1. Argo CD and Flux run an agent inside the cluster.
  2. The agent watches Git and pulls the desired state into the cluster.
  3. It keeps reconciling differences, which is pull mode. Option A is correct.

Why the other options are wrong

  • B. They sync continuously, not in a monthly batch.
  • C. They automate apply instead of needing an operator to apply each file.
  • D. Laptops do not push to the cluster in these tools.

Tip: Argo CD and Flux are pull-based GitOps tools.

Question 6Medium

How does GitOps help with audits?

  1. It replaces the need for access control, because anyone can see every change in the log
  2. Every change is a commit with author, review and timestamp
  3. It deletes old logs
  4. It hides changes from auditors

Answer: B. Every change is a commit with author, review and timestamp

Explanation

Git history shows who changed what, when, and who approved it.

Step-by-step solution

  1. Git records every change as a commit.
  2. Each commit shows its author, the review, and the time.
  3. That gives a clear audit trail, so option B is correct.

Why the other options are wrong

  • A. A log does not replace access control.
  • C. GitOps keeps history rather than deleting old logs.
  • D. The change history is visible to auditors, not hidden from them.

Tip: Git history answers who changed what, when, and who approved it.

Question 7Medium

Many teams keep application source and deployment manifests in separate repositories because:

  1. It makes builds compile faster
  2. GitOps tools can read only one file per repository, so each app needs its own separate repo
  3. Git cannot store YAML next to code
  4. Config changes and image bumps are reviewed and versioned apart from code

Answer: D. Config changes and image bumps are reviewed and versioned apart from code

Explanation

A config repo gives a clear history of what was deployed where, and avoids CI loops.

Step-by-step solution

  1. Application source and deployment config change for different reasons.
  2. Separate repos let config changes and image bumps be reviewed and versioned on their own.
  3. Option D gives this reason, so it is correct.

Why the other options are wrong

  • A. Repository layout does not change how fast the code compiles.
  • B. GitOps tools read whole directories, not one file per repository.
  • C. Git stores YAML files in any repository, next to code or not.

Tip: Separate config repos give a clear history of what was deployed where.

Question 8Medium

In GitOps, someone edits a Deployment directly with kubectl. What does the GitOps agent usually do?

  1. Detect drift and revert it to match Git
  2. Delete the namespace
  3. Commit the change back to Git automatically
  4. Ignore it forever

Answer: A. Detect drift and revert it to match Git

Explanation

Self-healing keeps the cluster equal to the committed desired state.

Step-by-step solution

  1. GitOps ensures cluster matches Git's desired state.
  2. Editing Deployment directly creates drift.
  3. Agent detects drift and reverts changes.
  4. Reverting makes cluster match Git again.
  5. Final answer: Detect drift and revert it to match Git.

Why the other options are wrong

  • B. Deleting the namespace would destroy workloads; GitOps agents revert changes, they do not delete namespaces.
  • C. The agent does not commit to Git; it syncs the cluster to what Git already says.
  • D. Ignoring drift would leave the cluster out of sync; GitOps agents are built to correct it.

Tip: Always use Git for infrastructure as code, not direct edits.

Question 9Medium

Why does GitOps fit well with Kubernetes in particular?

  1. Kubernetes is driven by declarative manifests and controllers
  2. GitOps works only with Kubernetes and nothing else
  3. Kubernetes stores its state in Git
  4. Kubernetes cannot be changed with kubectl

Answer: A. Kubernetes is driven by declarative manifests and controllers

Explanation

Declarative YAML can be versioned in Git and reconciled by in-cluster controllers.

Step-by-step solution

  1. GitOps uses declarative configurations to define desired states.
  2. Kubernetes relies on declarative manifests and controllers to manage state.
  3. This alignment makes GitOps a natural fit for Kubernetes.
  4. Changes are versioned in Git, enabling traceability and collaboration.
  5. GitOps ensures consistency by reconciling actual state with desired state.

Why the other options are wrong

  • B. GitOps is not limited to Kubernetes; it works with other systems that have declarative config.
  • C. Kubernetes does not store its state in Git; state lives in etcd, and Git holds the desired manifests.
  • D. kubectl can still change Kubernetes; GitOps just discourages it, since the agent reverts manual edits.

Tip: Look for declarative tools and version control in GitOps and Kubernetes compatibility.

Question 10Hard

How should secrets be handled in a GitOps repository?

  1. Put them in the README
  2. Base64-encode them and commit them, since that is enough protection
  3. Commit them in plain text since the repo is private
  4. Store them encrypted (e.g. sealed secrets) or reference an external secret manager

Answer: D. Store them encrypted (e.g. sealed secrets) or reference an external secret manager

Explanation

Git history is permanent and widely replicated; only encrypted secrets or references belong there.

Step-by-step solution

  1. Secrets in GitOps must be protected to avoid exposure.
  2. Plain text or Base64-encoding leaves secrets vulnerable.
  3. Encrypted secrets or external managers ensure security.
  4. Only encrypted secrets or references should be stored in the repo.
  5. Final answer: Store them encrypted (e.g. sealed secrets) or reference an external secret manager.

Why the other options are wrong

  • A. A README is public-facing docs, so putting secrets there exposes them to everyone.
  • B. Base64 is an encoding, not encryption; anyone can decode it, so it is not protection.
  • C. A private repo is not enough: anyone with access, and every clone, can read plain text secrets.

Tip: Always encrypt secrets or use a secret manager in GitOps.

Practise all 14 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all DevOps & Kubernetes topics · All topics