Kubernetes RBAC
KubeVela applies Components and runs Workflow with the controller service account, which allows you to manage components across namespaces.
However, in the soft-multitenancy environments, such as Namespaces as a Service, you may need to limit Applications to allow applying components or running workflows in the authorized namespaces only.
You can limit by setting app.oam.dev/service-account-name
annotation with the specific ServiceAccount name. If defined, KubeVela will use the given ServiceAccount instead of the controller ServiceAccount when applying Components and running Workflow.
#
ExampleLet's assume that we have two namespaces:
demo-service
: for managing applicationdemo-service-prod
: to deploy components for the production environment
In this example, we will make the Application use a specific ServiceAccount instead of the controller ServiceAccount.
#
Creating ServiceAccountCreate deployer
ServiceAccount in demo-service
namespace.
#
Creating Role/RoleBindingAllow deployer
ServiceAccount in demo-service
to manage Deployments in demo-service-prod
by creating Role/RoleBinding.
#
Deploying an Application with ServiceAccountAfter deploying the Application, you can check the Application is deployed successfully.
If you set non-authorized ServiceAccount to the annotation, you can find an error message like below in the Application status.
#
LimitationsServiceAccount Integration doesn't support Multi-Cluster Application Delivery. Even if you set ServiceAccount name to the annotation, KubeVela will ignore it if the scope is a non-local cluster.
You can follow up about this issue on GitHub.