This guide will install Feast into a Kubernetes cluster on GCP. It assumes that all of your services will run within a single Kubernetes cluster. Once Feast is installed you will be able to:
- Define and register features.
- Load feature data from both batch and streaming sources.
- Retrieve features for model training.
- Retrieve features for online serving.
{% hint style="info" %} This guide requires Google Cloud Platform for installation.
- BigQuery is used for storing historical features.
- Google Cloud Storage is used for intermediate data storage. {% endhint %}
- Google Cloud SDK installed, authenticated, and configured to the project you will use.
- Kubectl installed.
- Helm (2.16.0 or greater) installed on your local machine with Tiller installed in your cluster. Helm 3 has not been tested yet.
First define the environmental variables that we will use throughout this installation. Please customize these to reflect your environment.
export FEAST_GCP_PROJECT_ID=my-gcp-project
export FEAST_GCP_REGION=us-central1
export FEAST_GCP_ZONE=us-central1-a
export FEAST_BIGQUERY_DATASET_ID=feast
export FEAST_GCS_BUCKET=${FEAST_GCP_PROJECT_ID}_feast_bucket
export FEAST_GKE_CLUSTER_NAME=feast
export FEAST_SERVICE_ACCOUNT_NAME=feast-saCreate a Google Cloud Storage bucket for Feast to stage batch data exports:
gsutil mb gs://${FEAST_GCS_BUCKET}Create the service account that Feast will run as:
gcloud iam service-accounts create ${FEAST_SERVICE_ACCOUNT_NAME}
gcloud projects add-iam-policy-binding ${FEAST_GCP_PROJECT_ID} \
--member serviceAccount:${FEAST_SERVICE_ACCOUNT_NAME}@${FEAST_GCP_PROJECT_ID}.iam.gserviceaccount.com \
--role roles/editor
gcloud iam service-accounts keys create key.json --iam-account \
${FEAST_SERVICE_ACCOUNT_NAME}@${FEAST_GCP_PROJECT_ID}.iam.gserviceaccount.com{% hint style="warning" %} Provisioning a GKE cluster can expose your services publicly. This guide does not cover securing access to the cluster. {% endhint %}
Create a GKE cluster:
gcloud container clusters create ${FEAST_GKE_CLUSTER_NAME} \
--machine-type n1-standard-4Create a secret in the GKE cluster based on your local key key.json:
kubectl create secret generic feast-gcp-service-account --from-file=key.jsonFor this guide we will use NodePort for exposing Feast services. In order to do so, we must find an External IP of at least one GKE node. This should be a public IP.
export FEAST_IP=$(kubectl describe nodes | grep ExternalIP | awk '{print $2}' | head -n 1)
export FEAST_CORE_URL=${FEAST_IP}:32090
export FEAST_ONLINE_SERVING_URL=${FEAST_IP}:32091
export FEAST_BATCH_SERVING_URL=${FEAST_IP}:32092Add firewall rules to open up ports on your Google Cloud Platform project:
gcloud compute firewall-rules create feast-core-port --allow tcp:32090
gcloud compute firewall-rules create feast-online-port --allow tcp:32091
gcloud compute firewall-rules create feast-batch-port --allow tcp:32092
gcloud compute firewall-rules create feast-redis-port --allow tcp:32101
gcloud compute firewall-rules create feast-kafka-ports --allow tcp:31090-31095Run the following command to provide Tiller with authorization to install Feast:
kubectl apply -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
EOFInstall Tiller:
helm init --service-account tillerClone the Feast repository and navigate to the charts sub-directory:
git clone https://github.com/gojek/feast.git && cd feast && \
export FEAST_HOME_DIR=$(pwd) && \
cd infra/charts/feastMake a copy of the Helm values.yaml so that it can be customized for your Feast deployment:
cp values.yaml my-feast-values.yamlUpdate my-feast-values.yaml based on your GCP and GKE environment.
- Required fields are paired with comments which indicate whether they need to be replaced.
- All occurrences of
EXTERNAL_IPshould be replaced with either a domain pointing to a load balancer for the cluster or the IP stored in$FEAST_IP. - Replace all occurrences of
YOUR_BUCKET_NAMEwith your bucket name stored in$FEAST_GCS_BUCKET - Change
feast-serving-batch.store.yaml.bigquery_config.project_idto your GCP project Id. - Change
feast-serving-batch.store.yaml.bigquery_config.dataset_idto the BigQuery dataset that Feast should use.
Install the Feast Helm chart:
helm install --name feast -f my-feast-values.yaml .Ensure that the system comes online. This will take a few minutes.
kubectl get podsThere may be pod restarts while waiting for Kafka to come online.
NAME READY STATUS RESTARTS AGE
pod/feast-feast-core-666fd46db4-l58l6 1/1 Running 2 5m
pod/feast-feast-serving-online-84d99ddcbd 1/1 Running 3 6m
pod/feast-kafka-0 1/1 Running 0 3m
pod/feast-kafka-1 1/1 Running 0 4m
pod/feast-kafka-2 1/1 Running 0 4m
pod/feast-postgresql-0 1/1 Running 0 5m
pod/feast-redis-master-0 1/1 Running 0 5m
pod/feast-zookeeper-0 1/1 Running 0 5m
pod/feast-zookeeper-1 1/1 Running 0 5m
pod/feast-zookeeper-2 1/1 Running 0 5mInstall the Python SDK using pip:
pip install feastConfigure the Feast Python SDK:
feast config set core_url ${FEAST_CORE_URL}
feast config set serving_url ${FEAST_ONLINE_SERVING_URL}Test whether you are able to connect to Feast Core
feast projects list
Should print an empty list:
NAME
That's it! You can now start to use Feast!
Please see our examples to get started.