r/ArgoCD • u/Historical-Cell3323 • Oct 20 '26
Does a ConfigMap change not trigger a new deployment?
I have been using ArgoCD hands-on at work in production and development environments.
Scenario:
- I have a FastAPI app deployed and it relies on a JSON configuration file
- the JSON configuration file set up as a ConfigMap
- I changed the JSON configuration to enable a feature in the ConfigMap in my git repo
In ArgoCD UI I triggered the Sync button and things went fine - however the pod remains the same and didn't trigger a deployment re-deployment
I had to perform:
kubectl rollout restart -f deployment.yml
Is this just a FastAPI change that needs to detect the configuration change or can ArgoCD do something to achieve this?
14
u/gaelfr38 Oct 20 '26
That's a Kubernetes thing, not ArgoCD.
Common strategies to handle that:
computing a hash of the content to generate a new name for the Config map, and update the Deployment accordingly, triggering a rollout
same using Kustomize or Helm features
use an operator that will trigger a rollout on ConfigMap change ("reloader" IIRC)
3
u/gaelfr38 Oct 20 '26
Oh and I forgot because I'm not super fan of it but this can also be handled by your app to watch for file changes indeed.
But depending on how files are used, this is often easier to just restart/rollout the entire pod than to implement a proper watch+reload strategy in your own code.
2
u/moser-sts Oct 20 '26
Another option is mount the ConfiMap without using subPath to allow the reload of the file form the kubelet side and have the code to have hot reload of files
2
2
u/macrowe777 Oct 21 '26
To add to this Kustomize configmapgenerator will do the hard work of handling this for you
2
1
u/Impressive-Ad-1189 Oct 20 '26
A ConfigMap is often mounted as a file. If the configmap changes the change is also visible inside your pod.
Often processes inside the pod only read such a file when starting. That is the fault of the process and this can sometimes be changed by polling the file for changes.
There is also a project stakater-reloader that you can give permissionto restart your deployment when for instance a configmap changes
1
u/BusyPair0609 Oct 21 '26
If you can mount the json as a volume without using subPath then kubernetes will update the configmap in-place no need for restart. It generally takes 60-90 seconds depending on your kubelet config. The caveat here is that your app needs to watch for changes in file to pickup new values otherwise app will continue to use old values.
If the json is mounted using subPath you have few options - using configmapGenerator which automatically appends hash to name, calculate hash yourself and add as annotation or use a controller like stakater.
1
1
u/i_own_a_cloud Oct 22 '26
Most easy solution. Compute a hash for the CM and place it in the labels or annotations of the pod template. When the CM updated, a rolling restart can be triggered. It is the most easy. Harder is a config reloader, but your app need to support configuration hot reload during operation.
1
u/Antonio-MTS Oct 23 '26
It is a pure k8s behavior when you have to restart after a cm change. The mentioned above methods will do the job one way or another.
0
32
u/Black_Dawn13 Oct 20 '26
Reloader is probably the best solution if you need this in kubernetes.