Skip to content

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

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

kubectl get pods

Next step is to see what’s happening with the replicaset

kubectl get rs

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

kubectl describe rs my-service-a-5549cbc6c8

The error

Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedCreate 2m10s.. replicaset-controller Error creating: pods "my-service-a-5549cbc6c8-" is forbidden: error looking up service account my-apps/my-service-a: serviceaccount "my-service-a" not found
Code language: plaintext (plaintext)

It’s down to a missing Service Account!

The fix

You need to create a service account:

kubectl create serviceaccount my-service-a
Code language: Bash (bash)

Remember to create it in the same namespace as the deployment.

So if you have a deployment going to my-apps namespace, then you should do the following:

kubectl create serviceaccount my-service-a -n my-apps
Code language: Bash (bash)

See also  What temperature does your Mac CPU idle at?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x