1

Is there any way to set label on secret created by ServiceAccount? For now it is the only secret I'm not able to configure with label.

apiVersion: v1
kind: ServiceAccount
metadata:
  name: forum-sa

enter image description here

dnf
  • 1,659
  • 2
  • 16
  • 29

2 Answers2

1

Please use the below configuration using the service account with kubectl,Follow the documentation1

kubectl get secret --namespace={namespace}

By using above kubectl command which will help to set label namespace for secrets.

0

Using the service account token with kubectl:

https://www.ibm.com/docs/en/cloud-paks/cp-management/2.0.0?topic=kubectl-using-service-account-tokens-connect-api-server

We can patch the secrets label with the required labels or we can also add the labels during secrets creation

  • Hmm I'm still not sure how exactly I can set this label. I have my deployment definition in yaml files (they are build by kustomize). Where exactly I have to apply the patch to set label in the created token? I tried set label in ServiceAccount but this label is not set in token – dnf May 25 '22 at 12:48
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 27 '22 at 03:14