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:

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

Follow Kubedemy LinkedIn

Follow Kubedemy Telegram

Leave a Reply

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