Welcome to the Linux Foundation Forum!

How to determine which username and group I have in a cluster using kubectl

Authentication section of k8s documentation is talking about:

When enabled, requests that are not rejected by other configured authentication methods are treated as anonymous requests, and given a username of system:anonymous and a group of system:unauthenticated.

since there are different ways to identify myself when interacting with the API, it's not always clear how it recognised me - I mean as which username and which group it thinks I belong to. Is there any way to see that via kubectl?

Comments

  • Thank you @serewicz. Yes, I understand that there is no session as such, but when I have started to use kubectl from one machine, provided that the environment in which it is running remains stable, I will be consistently recognised as the same user having the same groups. Just wanted to understand how a troubleshooting workflow would look like if I'm expecting that I'm user X with one set of groups, but in fact I'm being recognised as user Y with another set of groups. Due to the fact that user identity can be taken from many different places, user may expect that it's taken from, say, config file, but there is an environment variable that he is not aware of which instructs kubectl to use some other identity.

    Checked your suggestion with auditing and indeed, this information is shown. So it provides some way of doing this.

Categories

Upcoming Training