why dont I have authority to access secret in kubernetes code example
Example 1: kubectl print secret value
kubectl get secret <my_secret_name> -o 'go-template={{index .data "<key_name>"}}' | base64 -d
ex:
kubectl get secret my-secret -o 'go-template={{index .data "username"}}' | base64 -d
Example 2: RBAC in kubernetes docs
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
# "namespace" omitted since ClusterRoles are not namespaced
name: secret-reader
rules:
- apiGroups: [""]
#
# at the HTTP level, the name of the resource for accessing Secret
# objects is "secrets"
resources: ["secrets"]
verbs: ["get", "watch", "list"]