docs/reference/auth/kubernetes_auth_setup.md
This document describes the authentication and authorization capabilities in Feast that support groups, namespaces and roles extraction from Kubernetes tokens.
Feast supports extracting user groups, namespaces and roles of both Service Account and User from Kubernetes authentication tokens. This allows for more granular access control based on:
To ensure the Kubernetes RBAC environment aligns with Feast's RBAC configuration, follow these guidelines:
Permission instances must have corresponding Kubernetes RBAC Role names.Role must reside in the same namespace as the Feast service.ServiceAccount.RoleBinding that links the client ServiceAccount to the RBAC Role must be defined in the namespace of the Feast service.To ensure the Kubernetes RBAC environment aligns with Feast's RBAC configuration, follow these guidelines:
Permission instances must have corresponding Kubernetes Group and Namespace names.Permission instances.ServiceAccount or user.Permission instances.Grants access based on user role membership.
from feast.permissions.policy import RoleBasedPolicy
policy = RoleBasedPolicy(roles=["data-team", "ml-engineers"])
Grants access based on user group membership.
from feast.permissions.policy import GroupBasedPolicy
policy = GroupBasedPolicy(groups=["data-team", "ml-engineers"])
Grants access based on user namespace association.
from feast.permissions.policy import NamespaceBasedPolicy
policy = NamespaceBasedPolicy(namespaces=["production", "staging"])
Grants access only when user is added into either permitted groups OR namespaces.
from feast.permissions.policy import CombinedGroupNamespacePolicy
policy = CombinedGroupNamespacePolicy(
groups=["data-team"],
namespaces=["production"]
)
The server automatically extracts groups, namespaces and roles when using Kubernetes authentication. No additional configuration is required beyond the existing Kubernetes auth setup.
For external users (not service accounts), you can provide a user token in the configuration:
Refer examples of providing the token are described in doc User Token Provisioning
from feast.feast_object import ALL_RESOURCE_TYPES
from feast.permissions.action import READ, AuthzedAction, ALL_ACTIONS
from feast.permissions.permission import Permission
from feast.permissions.policy import (
RoleBasedPolicy,
GroupBasedPolicy,
NamespaceBasedPolicy,
CombinedGroupNamespacePolicy
)
# Role-based permission
role_perm = Permission(
name="role_permission",
types=ALL_RESOURCE_TYPES,
policy=RoleBasedPolicy(roles=["reader-role"]),
actions=[AuthzedAction.DESCRIBE] + READ
)
# Group-based permission (new)
data_team_perm = Permission(
name="data_team_permission",
types=ALL_RESOURCE_TYPES,
policy=GroupBasedPolicy(groups=["data-team", "ml-engineers"]),
actions=[AuthzedAction.DESCRIBE] + READ
)
# Namespace-based permission (new)
prod_perm = Permission(
name="production_permission",
types=ALL_RESOURCE_TYPES,
policy=NamespaceBasedPolicy(namespaces=["production"]),
actions=[AuthzedAction.DESCRIBE] + READ
)
# Combined permission (new)
dev_staging_perm = Permission(
name="dev_staging_permission",
types=ALL_RESOURCE_TYPES,
policy=CombinedGroupNamespacePolicy(
groups=["dev-team"],
namespaces=["staging"]
),
actions=ALL_ACTIONS
)
Run feast apply from CLI/API/SDK on server or from client(if permitted) to apply the permissions.
Token Access Review Fails
Groups/Namespaces Not Extracted
Permission Denied