Software Engineering

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

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


So that you’ve run a deployment and tried to test 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 identify and do a describe on it:

kubectl describe rs my-service-a-5549cbc6c8

The error

Occasions:
  Sort     Cause            Age           From         Message
  ----     ------            ----          ----         -------
  Warning  FailedCreate      2m10s..  replicaset-controller  Error creating: pods "my-service-a-5549cbc6c8-" is forbidden: error wanting 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

You could create a service account:

kubectl create serviceaccount my-service-a

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

So you probably have a deployment going to my-apps namespace, then it’s best to do the next:

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

About the author

admin

Leave a Comment