Immutable ConfigMap and Secret in Kubernetes

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 the key is set to true, the ConfigMap or Secret can not be mutated. It can only be deleted and recreated.

cm.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  ...
data:
  ...
immutable: true
secret.yaml:
apiVersion: v1
kind: Secret
metadata:
  ...
type: Opaque
data:
  ...
immutable: true