Cloud Technology Community Question

Managing configuration drift and manual "hotfixes" in a GitOps-managed Kubernetes cluster.

Posted on 2024-09-15 • In Cloud Technology • By Matthew Brown

We recently had an incident where an engineer made a manual 'kubectl' change in production to fix a CPU limit during an outage. Ten minutes later, our GitOps controller overwrote his change and the pod crashed again. This "fight" between the human and the controller is frustrating. How do you handle emergency hotfixes in a GitOps world? Should we temporarily disable the sync, or is there a better way to handle these edge cases?

3 Answers 9,474 Views

All answers to this question 3 Answers

Barbara Robinson Answered on 2024-09-18
Answered

This is the "drift" paradox. The whole point of GitOps is to prevent manual changes, but production emergencies don't always wait for a PR review. The best practice is to never disable the sync entirely. Instead, use the "Pause" feature in Argo CD or Flux. This stops the reconciliation temporarily while you fix the issue manually. However, you MUST have a post-incident process where that manual change is committed to Git and the "Pause" is removed. Some teams use a "Break-Glass" service account that triggers an alert the second someone uses 'kubectl' on a production namespace, ensuring the drift is documented immediately.

Thomas Wright Answered on 2024-09-20
Answered

Have you tried using a "Fast-Track" PR process with a dedicated label that bypasses some of the longer CI checks for emergency fixes?

Daniel White Commented on 2024-09-22
Commented

We haven't tried a fast-track PR yet. My worry is that "fast" usually means "untested." How do you ensure that an emergency PR doesn't accidentally introduce a syntax error that breaks the whole GitOps sync for the entire namespace? Is there a way to run a 'dry-run' sync before the PR is merged?

Margaret Lewis Answered on 2024-09-24
Answered

We use 'Kustomize' overlays for different environments. If we need a hotfix, we change the 'prod' overlay and push. It takes 2 minutes, which is usually fast enough for us.

Matthew Brown Commented on 2024-09-25
Commented

2 minutes is ideal! If the pipeline is that fast, there's almost no reason to ever touch 'kubectl' manually in the first place.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.