[Solved] Error creating: pods “my-service-a-xxx” is forbidden: error trying up service account my-apps/my-service-a: serviceaccount “my-service-a” not discovered

0
9
Adv1


Adv2

So that you’ve run a deployment and tried to examine the pods and there’s nothing there!

kubectl get pods

Subsequent step is to see what’s occurring with the replicaset

kubectl get rs

Then take the replicaset title and do a describe on it:

kubectl describe rs my-service-a-5549cbc6c8

The error

Occasions:
  Sort     Motive            Age           From         Message
  ----     ------            ----          ----         -------
  Warning  FailedCreate      2m10s..  replicaset-controller  Error creating: pods "my-service-a-5549cbc6c8-" is forbidden: error trying up service account my-apps/my-service-a: serviceaccount "my-service-a" not discovered

It’s all the way down to a lacking Service Account!

The repair

It is advisable create a service account:

kubectl create serviceaccount my-service-a

Keep in mind to create it in the identical namespace because the deployment.

So when you have a deployment going to my-apps namespace, then it is best to do the next:

kubectl create serviceaccount my-service-a -n my-apps
Adv3