Skip to main content

RBAC Configuration

FastGateway backend requires specific Kubernetes RBAC permissions to manage Envoy Gateway resources. This document provides the necessary configuration.

Complete RBAC Manifest​

Create a file named fastgateway-rbac.yaml with the following content:

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fastgateway
namespace: fastgateway
---
apiVersion: v1
kind: Secret
metadata:
name: fastgateway-token
namespace: fastgateway
annotations:
kubernetes.io/service-account.name: fastgateway
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: fastgateway
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["gateways"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["gatewayclasses"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["httproutes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["grpcroutes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["tcproutes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["udproutes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["referencegrants"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["securitypolicies"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["backendtrafficpolicies"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["clienttrafficpolicies"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["envoyproxies"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["envoyextensionpolicies"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["backends"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["gateway.envoyproxy.io"]
resources: ["httproutefilters"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: fastgateway
subjects:
- kind: ServiceAccount
name: fastgateway
namespace: fastgateway
roleRef:
kind: ClusterRole
name: fastgateway
apiGroup: rbac.authorization.k8s.io

Apply the Configuration​

# Create the namespace first
kubectl create namespace fastgateway

# Apply the RBAC configuration
kubectl apply -f fastgateway-rbac.yaml

Permissions Reference​

API GroupResourcePermissionsPurpose
"" (core)namespacesget, list, watch, create, update, patch, deleteManage project namespaces
"" (core)servicesget, list, watch, create, update, patch, deleteManage backend services
"" (core)secretsget, list, watch, create, update, patch, deleteStore TLS certificates and API keys
"" (core)configmapsget, list, watch, create, update, patch, deleteStore direct-response bodies and related config data
gateway.networking.k8s.iogatewaysget, list, watch, create, update, patch, deleteManage Gateway resources
gateway.networking.k8s.iogatewayclassesget, list, watch, create, update, patch, deleteManage GatewayClass resources
gateway.networking.k8s.iohttproutesget, list, watch, create, update, patch, deleteManage HTTP routing rules
gateway.networking.k8s.iogrpcroutesget, list, watch, create, update, patch, deleteManage gRPC routing rules
gateway.networking.k8s.iotcproutesget, list, watch, create, update, patch, deleteManage TCP routing rules for streams
gateway.networking.k8s.ioudproutesget, list, watch, create, update, patch, deleteManage UDP routing rules for streams
gateway.networking.k8s.ioreferencegrantsget, list, watch, create, update, patch, deleteAllow cross-namespace references for routing
gateway.envoyproxy.iosecuritypoliciesget, list, watch, create, update, patch, deleteManage authentication and authorization
gateway.envoyproxy.iobackendtrafficpoliciesget, list, watch, create, update, patch, deleteManage backend traffic policies (rate limiting, retries, etc.)
gateway.envoyproxy.ioclienttrafficpoliciesget, list, watch, create, update, patch, deleteManage client traffic policies
gateway.envoyproxy.ioenvoyproxiesget, list, watch, create, update, patch, deleteManage EnvoyProxy configuration for gateways
gateway.envoyproxy.ioenvoyextensionpoliciesget, list, watch, create, update, patch, deleteManage Lua/Wasm extension policies (including WAF)
gateway.envoyproxy.iobackendsget, list, watch, create, update, patch, deleteManage Envoy Gateway Backend resources
gateway.envoyproxy.iohttproutefiltersget, list, watch, create, update, patch, deleteManage HTTPRouteFilter resources

Retrieving the Service Account Token​

To get the token for the FastGateway service account:

kubectl get secret fastgateway-token -n fastgateway -o jsonpath='{.data.token}' | base64 -d

This token is provided per project when configuring the cluster connection (connection type api_token) through the FastGateway UI or API — it is stored encrypted in the database. There is no backend environment variable for it. When FastGateway runs inside the target cluster, you can instead use the in_cluster connection type, which relies on the pod's mounted service account token rather than a token you supply manually.

Verifying Permissions​

Test that the service account has the correct permissions:

# Check if the service account can list HTTPRoutes
kubectl auth can-i list httproutes.gateway.networking.k8s.io \
--as=system:serviceaccount:fastgateway:fastgateway

# Check if the service account can create SecurityPolicies
kubectl auth can-i create securitypolicies.gateway.envoyproxy.io \
--as=system:serviceaccount:fastgateway:fastgateway

Both commands should return yes if configured correctly.

Namespace-Scoped Alternative​

If you prefer namespace-scoped permissions instead of cluster-wide access, replace the ClusterRole and ClusterRoleBinding with Role and RoleBinding:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: fastgateway
namespace: your-namespace
rules:
# Same rules as ClusterRole
...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: fastgateway
namespace: your-namespace
subjects:
- kind: ServiceAccount
name: fastgateway
namespace: fastgateway
roleRef:
kind: Role
name: fastgateway
apiGroup: rbac.authorization.k8s.io

Note: You will need to create a Role and RoleBinding in each namespace where FastGateway needs to manage resources.