How to use kubectl with system:anonymous account without using impersonation with `--as=system:anonymous`?

3/24/2020

How to use kubectl with system:anonymous account without using impersonation with --as=system:anonymous?

How can I send requests with kubectl using the system:anonymous account?

I've tried using the --as= option, but this requires that the default service account has impersonation privileges, which it doesn't by default.

The only way I currently can send anonymous requests is by using curl.

-- Shuzheng
amazon-web-services
cloud
docker
kubernetes

1 Answer

3/24/2020

Set up a new configuration context that doesn't specify any authentication information and then use --context whatever. Or just use curl, that's honestly fine too since I'm really hoping this is just to confirm some security settings or similar. If you run kubectl with -v 10000000 (or some other huge number) it will actually show you the equivalent curl command to the request it is making.

-- coderanger
Source: StackOverflow