A new release needs a database migration that must finish before the new pods start. How do you implement it in Argo CD?
IntermediateScenarioSync Behaviour, Waves & Hooks
Answer
Situation read → Ordered, blocking step before the main apply.
What I'd do →
- Add a Job with
argocd.argoproj.io/hook: PreSyncandhook-delete-policy: BeforeHookCreation, using the same image tag as the release. - Set
backoffLimit: 1andactiveDeadlineSecondsso it fails fast. - Write the migration to be backward compatible (expand now, contract in a later release).
- Add a
SyncFailhook to alert the team.
Why → PreSync blocks the rollout on migration failure, keeping the old version running.
Interview tip → Mention expand/contract, because old pods keep running during the rollout.
More on Sync Behaviour, Waves & Hooks
Your app needs cert-manager's CRDs, an Issuer and then a Certificate, all in one Application. The first sync fails. What do you do?IntermediateAfter enabling `prune: true`, someone renames a folder and the next sync would delete a production StatefulSet and its PVCs. How do you prevent this class of incident?AdvancedYou want a smoke test to run after every deploy and mark the sync failed if it fails. How?BeginnerAn HPA scales your Deployment, but Argo CD with self-heal keeps resetting replicas to 2. What do you do?BeginnerYou must change a Deployment's label selector, which is immutable. How do you roll it out with Argo CD?AdvancedA team wants Argo CD to deploy only during business hours, except for emergencies. How do you set it up?Beginner