Repository navigation
Create a ServiceAccount for CoreDNS by default - #284
Merged
Merged
Conversation
With serviceAccount.create false, the chart's default since its first version, the ClusterRole that lets CoreDNS list and watch pods, services, endpoints, endpointslices and namespaces cluster-wide is bound to the namespace's "default" ServiceAccount. Every pod in that namespace that runs as default, kube-system in the documented install, can then read those objects across the cluster through its mounted token. serviceAccount.create now defaults to true: CoreDNS runs as its own ServiceAccount, named after the release, and the ClusterRoleBinding names it. serviceAccount.create: false with serviceAccount.name still selects an existing account, such as kubeadm's coredns when adopting it. A new unit test suite covers the defaults. Chart 1.49.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Martin Matyas <martin.matyas@tieto.com>
hagaibarel
approved these changes
Oct 19, 2026
Collaborator
|
Thanks for picking this up, definitely a welcomed change! |
Merged
1 task
1 task
1 task
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this pull request needed and what does it do?
With
serviceAccount.create: false, the chart's default since its first version, the ClusterRole that lets CoreDNSlistandwatchpods, services, endpoints, endpointslices and namespaces cluster-wide is bound to the release namespace'sdefaultServiceAccount. Every pod in that namespace that runs asdefault(kube-systemin the documented install) can read those objects across the cluster through its mounted token. Details in #283.This defaults
serviceAccount.createtotrue:charts/coredns/values.yaml:serviceAccount.create: true, with a comment on what the ClusterRole is bound to.serviceAccount.create: falsewithserviceAccount.namestill selects an existing account (e.g. kubeadm'scorednswhen adopting). The token stays mounted, since thekubernetesplugin needs it, and the autoscaler keeps its own account.charts/coredns/tests/serviceaccount_default_test.yaml: a new unit test suite for the defaults: the ServiceAccount is created, the ClusterRoleBinding's subject is that account and notdefault, the Deployment runs as it, andcreate: falsewithout a name still falls back todefault.serviceAccount.createrow.securitychangelog entry.On upgrade, the Deployment rolls to the new account, and the binding's subject moves from
defaultto it, so the namespace'sdefaultaccount loses the grant. A release whose generated name matches an existing account (e.g.corednsin kube-system on kubeadm) needs the README's adoption step, or an explicitserviceAccount.name.Verified on a fork, on the current
master:helm unittestsuites pass, including the new one;ct lintandct installpasskubectl auth can-i list pods --all-namespacesas the namespace'sdefaultaccount, on kindmaster: yes (binding subjectdefault). This change: no (subjectcoredns).dedicated_service_accountmaster, passes with this change; the essential tests are unchanged at 17 of 19These are fresh installs; the upgrade path from 1.48.2 was not run.
Which issues (if any) are related?
Closes #283.
Checklist:
🤖 Generated with Claude Code