I'd like to confirm information of the authenticated user and assigned role and assigned cluster role. How can I do it?
information of the authenticated user
When you see Define clusters, users, and contexts, you realize you need to get the information associated with a defined context.
kubectl config --kubeconfig=config-demo use-context dev-frontend
kubectl config --kubeconfig=config-demo view --minify
The output shows configuration information associated with the dev-frontend context:
apiVersion: v1
clusters:
- cluster:
certificate-authority: fake-ca-file
server: https://1.2.3.4
name: development
contexts:
- context:
cluster: development
namespace: frontend
user: developer
name: dev-frontend
current-context: dev-frontend
kind: Config
preferences: {}
users:
- name: developer
user:
client-certificate: fake-cert-file
client-key: fake-key-file
assigned role and assigned cluster role.
You can list roles for all users or clusters, but you still need to parse the result to get the one for a user or a cluster.
Example: "kubectl and seeing (cluster)roles assigned to subjects".