examples/rbac-remote/README.md
This demo showcases how to enable Role-Based Access Control (RBAC) for Feast using Kubernetes or OIDC Authentication type. The demo steps involve deploying server components (registry, offline, online) and client examples within a Kubernetes environment. The goal is to ensure secure access control based on user roles and permissions. For understanding the Feast RBAC framework Please read these reference documents.
This demo contains the following components:
The application works with Kubernetes or OpenShift and the instructions assume that you are using a Kubernetes or OpenShift cluster.
Step 1 : Create the Feast project with PostgreSQL.
kubectl port-forward svc/postgresql 5432:5432Step 1: Create Remote configuration Files
Set the auth type to kubernetes in the respective feature_store files
auth:
type: kubernetes
For each server, feature store YAML files can be created for example like below:
Registry Server: feature_store_registry.yaml
Offline Server : feature_store_offline.yaml
Online Server : feature_store_online.yaml
Step 2: Deploy the Server Components
Run the installation script. The setup script will deploy the server components based on the user's confirmation, enter k8s for kubernetes authentication deployment. The script will deploy all the components with the namespace feast-dev.
./install_feast.sh
Step 1: Setup Keycloak
feast-rbac from the admin console.feast-rbac realm, create a new client with the name feast-clientfeast-client.Step 2: Create the Server Feature Store Files
Set the auth type to oidc in the respective feature_store files
auth:
type: oidc
client_id: _CLIENT_ID__
auth_discovery_url: _OIDC_SERVER_URL_/realms/feast-rbac/.well-known/openid-configuration
For each server the feature store YAML files can be created for example like below:
Registry Server: feature_store_registry.yaml
Offline Server : feature_store_offline.yaml
Online Server : feature_store_online.yaml
Step 3: Deploy the Server Components
Run the installation script. Enter oidc for the Keycloak authentication deployment. The script will deploy all of the components with the namespace feast-dev.
./install_feast.sh
Step 1: Create the Client Feature Store YAML
kuberentes . See the client remote setting example here: feature_store.yamlStep 2: Deploy the Client Examples
| User | Service Account | Roles | Permission | Feast Resources | Actions |
|---|---|---|---|---|---|
| admin | feast-admin-sa | feast-admin-role | feast_admin_permission | FeatureView, OnDemandFeatureView, BatchFeatureView, StreamFeatureView, Entity, FeatureService, DataSource, ValidationReference, SavedDataset, Permission | CREATE, DESCRIBE, UPDATE, DELETE, READ_ONLINE, READY_OFFLINE, WRITE_ONLINE, WRITE_OFFLINE |
| user | feast-user-sa | feast-user-role | feast_user_permission | FeatureView, OnDemandFeatureView, BatchFeatureView, StreamFeatureView, Entity, FeatureService, DataSource, ValidationReference, SavedDataset, Permission | READ, READ_OFFLINE, READ_ONLINE |
| unauthorized-user | feast-unauthorized-user-sa |
Apply client creation examples YAuth type to oidcfeature_store.yaml or if required any other settings as show below. auth_discovery_url: https://keycloak-feast-dev.apps.com/realms/feast-rbac/.well-known/openid-configuration
client_id: feast-client
client_secret: update-this-value
username: ${FEAST_USERNAME}
password: ${FEAST_PASSWORD}
feast-client create the two roles feast-admin-role and feast-user-rolefeast-rbac realm, create 3 different users: admin-user, readonly-user, and unauthorized-user. Assign the password feast to each user.admin-user, go to Role mapping, and assign the feast-admin-role. Select the readonly-user and assign the feast-user-role. For the unauthorized-user, do not assign any roles.Apply client creation examples Yinstall_feast.sh has the option to apply permission from the pod with the user's confirmation Do you want to copy files and execute 'feast apply in the pod? (y/n).feast permissions list for more details use feast permissions list -v. Additionally, there are other commands such as:
feast permissions check / describe / list-rolesadmin-user can perform all actions on all objects.readonly-user can only read or query all objects.unauthorized user should not able to read or write any resources as no role is defined for this user.python feature_repo/test.pykubectl port-forward svc/postgresql 5432:5432
kubectl port-forward svc/feast-offline-server-feast-feature-server 8815:80
kubectl port-forward svc/feast-registry-server-feast-feature-server 6570:80
kubectl port-forward svc/feast-feature-server 6566:80
LOCAL_K8S_TOKEN in each example. The token can be obtained from the service account../cleanup_feast.sh