Kubernetes Hacks and Tricks – #1 Immutable ConfigMaps and Secrets
Sometimes you want to create configs/secrets for your applications, and you want to make sure when configs/secrets got created, nobody can change or update them. For example, you want to setup cloud credentials, your git token, database credentials, etc. and prevent any changes after being created in the Kubernetes cluster.
Follow our social media:
https://www.linkedin.com/in/ssbostan
https://www.linkedin.com/company/kubedemy
https://www.youtube.com/@kubedemy
Kubernetes ConfigMap and Secret resources have a field called immutable
which, if set to true, ensures that the data of ConfigMap/Secret cannot be updated after the resource is created. If any changes are needed, they should be created again.
ConfigMap Example:
Secret Example:
After applying these resources, you get an error if you update them.
for: "configmap.yaml": error when patching "configmap.yaml": ConfigMap "test-immutable" is invalid: data: Forbidden: field is immutable when `immutable` is set
If you like this series of articles, please share them and write your thoughts as comments here. Your feedback encourages me to complete this massively planned program.
Follow my LinkedIn https://www.linkedin.com/in/ssbostan
Follow Kubedemy LinkedIn https://www.linkedin.com/company/kubedemy
Follow Kubedemy Telegram https://telegram.me/kubedemy