Skip to content

Add constrained impersonation blog (KEP-5284)#52916

Open
benjaminapetersen wants to merge 2 commits intokubernetes:mainfrom
benjaminapetersen:kep-5284-constrained-impersonation-blog
Open

Add constrained impersonation blog (KEP-5284)#52916
benjaminapetersen wants to merge 2 commits intokubernetes:mainfrom
benjaminapetersen:kep-5284-constrained-impersonation-blog

Conversation

@benjaminapetersen
Copy link
Copy Markdown
Member

Feature blog post for KEP 5284 constrained impersonation: alpha.
KEP Issue: kubernetes/enhancements#5284
/area blog
/sig auth

cc @enj

Description

Issue

Closes: #

@k8s-ci-robot k8s-ci-robot added area/blog Issues or PRs related to the Kubernetes Blog subproject sig/auth Categorizes an issue or PR as relevant to SIG Auth. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 23, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 23, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 409cda5
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/6924f0e96ae6280008e0ad30
😎 Deploy Preview https://deploy-preview-52916--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@enj enj added this to SIG Auth Oct 24, 2025
@enj enj moved this to Needs Triage in SIG Auth Oct 24, 2025
@lmktfy
Copy link
Copy Markdown
Member

lmktfy commented Nov 4, 2025

Not yet ready for review, so:
/retitle [WIP] Add constrained impersonation blog (KEP-5284)

@k8s-ci-robot k8s-ci-robot changed the title KEP-5284: Constrained Impersonation Blog [WIP] Add constrained impersonation blog (KEP-5284) Nov 4, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 4, 2025
@graz-dev
Copy link
Copy Markdown
Contributor

Hi @benjaminapetersen 👋 v1.35 Communications team here,

@sohankunkerkar as author of #52900, I'd like you to be a writing buddy for @benjaminapetersen on this PR.

Please:

  • Review this PR, paying attention to the guidelines and review hints
  • Update your own PR based on any best practices you identify that should be applied
  • Remember to be compassionate with your fellow article author

@graz-dev
Copy link
Copy Markdown
Contributor

Hi @benjaminapetersen 👋 -- this is Graziano (@graz-dev) from the v1.35 Communications Team!

Just a friendly reminder that we are approaching the feature blog "ready for review" deadline: Friday 21st November. We ask you to have the blog PR in non-draft state, and all write-up to be complete, so that we can start the blog review from SIG Docs Blog team.

If you have any questions or need help, please don't hesitate to reach out to me or any of the Communications Team members. We are here to help you!

@graz-dev
Copy link
Copy Markdown
Contributor

Sorry @benjaminapetersen the correct deadline for "Feature Blog Ready for Review" is Monday 24 November.
So you still have some days to finish the content and change the status of the PR.

Sorry, my bad :(

@benjaminapetersen benjaminapetersen force-pushed the kep-5284-constrained-impersonation-blog branch from 48614af to 7fb23ae Compare November 24, 2025 20:34
@k8s-ci-robot k8s-ci-robot added the language/en Issues or PRs related to English language label Nov 24, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nate-double-u for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 24, 2025
@benjaminapetersen
Copy link
Copy Markdown
Member Author

Thanks @graz-dev, just pushed my update.
@enj for 👀 also!

@benjaminapetersen benjaminapetersen changed the title [WIP] Add constrained impersonation blog (KEP-5284) Add constrained impersonation blog (KEP-5284) Nov 24, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 24, 2025
Copy link
Copy Markdown
Member

@lmktfy lmktfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sohankunkerkar I've jumped in to provide a review.

@benjaminapetersen here you go. I get the sense this might be AI-written. Whether or not that's the case, I suggest doing rewrites in the places where it reads like AI writing.

I have also suggested many changes to align this article to our style guide. Doing that will help readers make sense of what parts are verbs, what parts are namespaces, etc.

[Ben Petersen](https://github.com/benjaminapetersen) (Microsoft)
---

## Constrained Impersonation: Prentending but Without the Fraud!
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Constrained Impersonation: Prentending but Without the Fraud!

We put the title at the top of the page using automation.


## Constrained Impersonation: Prentending but Without the Fraud!

The word "impersonation" tends to elicit bad vibes. In a world where
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The word "impersonation" tends to elicit bad vibes. In a world where
The word _impersonation_ tends to elicit bad vibes. In a world where


The word "impersonation" tends to elicit bad vibes. In a world where
security threats lurk around every corner, rarely do we think of impersonation
as a good thing. But this release we are here to give you some new tools
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
as a good thing. But this release we are here to give you some new tools
as a good thing. But this release, I am here to give you some news
about tools

I changed "we" here to I because there is only one author; see https://kubernetes.io/docs/contribute/blog/article-submission/#article-content and https://kubernetes.io/docs/contribute/style/style-guide/#avoid-using-we

You think fraud, spam calls, or that one colleague who can perfectly copy
your on-call voice. In Kubernetes, though, impersonation is a very real and
very useful capability. And now, with constrained impersonation, it’s also a
lot safer.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lot safer.
When you read "impersonation", you perhaps don’t think _security feature_.
You think fraud, spam calls, or that one colleague who can perfectly copy
your on-call voice. In Kubernetes, though, [impersonation](/docs/reference/access-authn-authz/authentication/#user-impersonation) is a very real and
very useful capability. And now, with constrained impersonation, it's also a
lot safer.

Hyperlink is optional but recommended.

very useful capability. And now, with constrained impersonation, it’s also a
lot safer.

This post walks through what constrained impersonation is, how it works under
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This post walks through what constrained impersonation is, how it works under
This post walks through what _constrained impersonation_ is, how it works under

Comment on lines +316 to +322
## Why this is safer (and still backwards compatible)

Constrained impersonation is designed to be **additive** and **opt-in**:

- If you do nothing, legacy impersonation keeps working as before.
- You can enable the `ConstrainedImpersonation` feature gate, then start
granting the new verbs to specific controllers or workflows.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads like an LLM wrote it, probably Anthropic Claude 4. If that's true, I recommend a reword to sound more like a human.

verbs: ["impersonate-on:user-info:get"]
```

Bind these to the deputy service account. Now, when the deputy impersonates a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Bind these to the deputy service account. Now, when the deputy impersonates a
Bind these to the deputy controller's ServiceAccount. Now, when the deputy impersonates a


- Users to keep control over *what they are allowed to do*.
- The deputy to act "as the user" for just this one action, so audit logs and
admission behave as if the user did it themselves.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
admission behave as if the user did it themselves.
admission behave as if the user did it themselves.

Comment on lines +275 to +276
1. Give the deputy permission to impersonate user identities using
`impersonate:user-info`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Give the deputy permission to impersonate user identities using
`impersonate:user-info`.
1. Give the deputy controller permission to impersonate user identities, using
**impersonate:user-info**.

- Impersonate **its own node**, and
- Use that impersonation only to `list` Pods as allowed by the role.

It does *not* become an all-powerful node or cluster admin.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It does *not* become an all-powerful node or cluster admin.
It does **not** become an all-powerful node or cluster admin.

Copy link
Copy Markdown
Member

@lmktfy lmktfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sohankunkerkar I've jumped in to provide a review.

@benjaminapetersen here you go. I get the sense this might be AI-written. Whether or not that's the case, I suggest doing rewrites in the places where it reads like AI writing.

I have also suggested many changes to align this article to our style guide. Doing that will help readers make sense of what parts are verbs, what parts are namespaces, etc.

security threats lurk around every corner, rarely do we think of impersonation
as a good thing. But this release we are here to give you some new tools
to make impersonating users, groups, service accounts and nodes as exciting
as it sounds, but without the fraud!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as it sounds, but without the fraud!

Funny, but perhaps a little too informal

Comment on lines +19 to +20
When you hear "impersonation", you probably don’t think "security feature".
You think fraud, spam calls, or that one colleague who can perfectly copy
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant given the first paragraph, and it feels a little repetitive

Comment on lines +29 to +30
Spoiler: we’re not giving your controllers a fake mustache and a stolen
passport. We’re giving them a tightly scoped, auditable permission slip.
Copy link
Copy Markdown
Contributor

@pmengelbert pmengelbert Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaning a little heavily on the "double-meaning of impersonation" bit. As a joke it merits one usage, and maybe a callback in the closing line 😁

Copy link
Copy Markdown
Member

@enj enj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass.

Comment on lines +13 to +23
The word "impersonation" tends to elicit bad vibes. In a world where
security threats lurk around every corner, rarely do we think of impersonation
as a good thing. But this release we are here to give you some new tools
to make impersonating users, groups, service accounts and nodes as exciting
as it sounds, but without the fraud!

When you hear "impersonation", you probably don’t think "security feature".
You think fraud, spam calls, or that one colleague who can perfectly copy
your on-call voice. In Kubernetes, though, impersonation is a very real and
very useful capability. And now, with constrained impersonation, it’s also a
lot safer.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This intro is a bit much, IMO.

- `Impersonate-Uid`
- `Impersonate-Extra-*`

And at the `kubectl` level, with flags like `--as` and `--as-group`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the other two flags.


---

## The problem: great for humans, too scary for controllers
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is great for humans either.

kubectl --as=panda@myfavoritebears.com get pods -n prod
```

If this works, you know that Panda can list Pods in `prod`. If it fails, you
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If this works, you know that Panda can list Pods in `prod`. If it fails, you
If this works, you know that `panda` can list `pods` in `prod`. If it fails, you


## The problem: great for humans, too scary for controllers

Legacy impersonation is intentionally powerful. A cluster admin might use it
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it was ever truly intentional to not have scoping.

Comment on lines +151 to +170
1. **Check: can you impersonate this identity at all?**

SAR for "who" you can impersonate, for example:

```yaml
apiVersion: authorization.k8s.io/v1
kind: SubjectAccessReview
spec:
resourceAttributes:
group: authentication.k8s.io
resource: users
name: panda
verb: impersonate:user-info
user: system:serviceaccount:default:deputy
```

If this fails, the request is denied (or falls back to legacy
impersonation, depending on how you’ve configured things).

2. **Check: what are you allowed to do *via* impersonation?**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have the order of the checks backwards.

verbs: ["impersonate-on:associated-node:list"]
```

You bind those roles to your node agent’s service account.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include the actual bindings as the scoping matters.


## Example: a deputy controller acting for users

Another story from the KEP: a "deputy" controller that opens VM consoles on
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if the story coming from the KEP is relevant.


- Much smaller blast radius if a controller is compromised.
- Clear RBAC intent: "this thing can impersonate X, but only to do Y on Z".
- Better audit information about *why* an impersonation was allowed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include an explicit section for migrating from the old to the new.

Comment on lines +339 to +358
## When should you use constrained impersonation?

You should consider constrained impersonation when:

- A controller needs to act *as* a user or node, but only for a narrow set of
actions.
- You want audit logs to show real users (or nodes) as the actor, even though
controllers are making the calls.
- You’d like to stop handing out raw `impersonate` and move toward
least-privilege delegation.

You probably don’t need constrained impersonation for:

- One-off human debugging as a cluster admin using `kubectl --as`.
- Simple clusters where impersonation isn’t used at all.

But as clusters grow, controllers multiply, and security teams ask sharper
questions like, "Why does this CNI daemonset effectively have admin
privileges?", constrained impersonation gives you a better answer than,
"Because it was convenient at the time."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with this section, you should use constrained impersonation always once it is available.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Changes Requested in SIG Auth Dec 1, 2025
@graz-dev
Copy link
Copy Markdown
Contributor

@benjaminapetersen can you please take a look to the pending suggestions?
Thankss

@benjaminapetersen
Copy link
Copy Markdown
Member Author

@graz-dev you bet. I'm still targeting polishing this off now that I'm back from the holidays.

@graz-dev
Copy link
Copy Markdown
Contributor

graz-dev commented Jan 8, 2026

Unfortunately this post can't be published on time to fit into the feature blog schedule.
I think we (comms & blog team) don't have any problem to publish it later as a standalone blog post.
@benjaminapetersen it's up to you and SIG-Auth to decide what to do with this PR.

cc @lmktfy @drewhagen

@benjaminapetersen
Copy link
Copy Markdown
Member Author

Ok great, I work with SIG-Auth all the time, should not be a problem to polish it off for outside the 1.35 release window instead. We'd love to keep getting the auth features more accessible, they can tend to be dense in the documentation!

@k8s-triage-robot
Copy link
Copy Markdown

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/blog Issues or PRs related to the Kubernetes Blog subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Changes Requested

Development

Successfully merging this pull request may close these issues.

7 participants