I'm going to have an unknown number of users access my K8s (specifically OpenShift if that helps) cluster. Each user will have their own random namespace. So I do not know the namespaces in advance as they will be dynamically created. But I want each user to be able to utilize a ServiceAccount that I create ahead of time.
So, if I create a ServiceAccount fooSA
in my namespace foo
, I'd like to be able to define a deployment that utilizes fooSA
from the bar
namespace. For example:
myapp.yaml
...
spec:
serviceAccount: fooSA
...
kubectl apply -f myapp.yaml -n bar
How can I accomplish this?
As ServiceAccounts are namespace scoped I cannot figure out a way to accomplish this.