Cannot create service account in Kubernetes v1.25.5
Blog you are following is from June 5, 2021 might be using the old k8s release, while in 2022-12-08 1.24 relased and you are using the 1.25
In 1.24 Kubernetes release there is change which don’t auto crate the secret when you are creating the ServiceAccount.
Steps to follow
If you want to create the secret you can create it with
kubectl create sa <Service account name>
Create a YAML file with below and update the name and Service Account name
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: token-secret
annotations:
kubernetes.io/service-account.name: "<Service Account name>"
kubectl apply -f <File created above>.yaml
Extra option
You can also use the kubectl in case just want to create the Token
kubectl create token jwt-tk --duration=999999h
Few ref
Read more here: Source link