question

WilliamAWang-0291 avatar image
0 Votes"
WilliamAWang-0291 asked Prrudram-MSFT commented

Modified configmap doesn't effect?

My app could access the current cluster and check the pods under specified namespace. If the pod has some unhealth logs it will send message to management team.

Here are the codes in config map:
data:
appsettings.Production.json: |-
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"logdurationsecond": 900,
"monitornamespace": [
"stockrater", "xconverterjob"
],
"mailfrom": "",
"mailto": "",
"mailhost": "",
"mailpassword": "",
"mailport": 587
}

The stage "monitornamespace" used to set to "default" and "test" for beta testing. And after that we set to the value above to some production workloads to let it monitor the production workload.
And here are the logs of cronjob running result:

187893-wechat-screenshot-20220329174741.png


So the question is, the configmap is updated but why the workload doesn't effect?

azure-kubernetes-service
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @WilliamAWang-0291,

Pods/Deployments don’t automatically restart when a mounted configmap is changed. For the full details you can follow the discussion at Facilitate ConfigMap rollouts / management · Issue #22368 · kubernetes/kubernetes (github.com)

However, if you are using Helm to manage your k8s resources you can use its features to help with this issue.
Helm | Chart Development Tips and Tricks

kind: Deployment
spec:
template:
metadata:
annotations: checksum/config: { { include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}

Hope this helps!


1 Vote 1 ·

0 Answers