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
It’s down to a missing Service Account!
The fix
You need to create a service account:
kubectl create serviceaccount my-service-a
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