Closed RamboRogers closed 1 year ago
Fixed by applying this.
apiVersion: v1
kind: Secret
metadata:
name: skooner-sa-token
annotations:
kubernetes.io/service-account.name: skooner-sa
type: kubernetes.io/service-account-token
@RamboRogers Thanks for catching this. Do you want to create a PR for this?
kubectl create token skooner-sa
is a simpler (and more secure) way of getting a time-bound token, rather than creating a token Secret API object
@tianni4104 Sure.
kubectl create secret generic skooner-sa-token --type=kubernetes.io/service-account-token --dry-run -o yaml \ | kubectl annotate --local -o yaml -f - kubernetes.io/service-account.name=skooner-sa \ | kubectl apply -f -
this will solve your problem
Thanks for your comments. A command line seems to be a better option in this case. I will close this issue as resolved.
In Kubernetes 1.24, ServiceAccount token secrets are no longer automatically generated.
Therefore the kubectl get secrets command is broken.