What do immutable ConfigMaps and Secrets solve?
knowledge of the immutable field.
setting immutable true blocks data edits, preventing accidental updates and letting the kubelet skip watches, reducing API server load.
What's really being asked
Whether you know that immutability is both a safety feature and a performance optimization, and how the kubelet's watch behavior drives cluster scalability.
The full answer
Marking a ConfigMap or Secret with immutable true permanently freezes its data; the API server rejects any update to the data or binaryData fields, and you cannot unset immutable either. To change config you create a new, differently named object and update workloads to reference it, which naturally fits a roll-forward, versioned-config approach. Two problems are solved. First, safety: it prevents accidental or unreviewed edits to a shared config from silently propagating to every consuming Pod and causing an outage. Second, and the headline benefit, performance: normally each kubelet opens a watch on every ConfigMap and Secret its Pods mount so it can push updates. In a large cluster this is a major source of API server and etcd load. Because immutable objects can never change, the kubelet skips the watch entirely, eliminating that traffic.
The mistakes people make
Thinking immutable lets you update values in place more safely. Believing you can toggle immutable off later. Confusing it with read-only mounts, which restrict the container's filesystem, not the object. Forgetting the recreate-with-new-name workflow.
What usually comes next
How do you roll out a new immutable config to a Deployment? Why does immutability reduce API server load specifically? How does this pair with hashing config names to trigger rollouts?
A concrete example
Set immutable true on a Secret named tls-certs-v3, reference it in the Deployment, and when certs rotate create tls-certs-v4 and bump the Deployment's reference, triggering a controlled rolling update rather than mutating the live object.
Interview question
Beyond preventing accidental edits, what is the main scaling benefit of marking a Secret immutable?
- a.It replicates the Secret to every node automatically
- b.It allows faster in-place updates across all Pods
- c.The kubelet can stop watching it, cutting API server loadCorrect
- d.It encrypts the Secret data at rest in etcd
Why? this is the answer
Because immutable objects can never change, kubelets skip the per-object watch they normally maintain, removing significant API server and etcd load in large clusters. Immutability does not encrypt data or enable in-place updates.
Just read this? Test yourself on what you have been reading.
Read the original → github.com
- #kubernetes
- #configmap
- #secrets
- #immutable
- #performance
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on kubernetes — each one lists the topics its interview covers.
See open roles