Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Example to install feast on local computer using Kind #4528

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
932 changes: 932 additions & 0 deletions examples/kind-quickstart/01-Install.ipynb

Large diffs are not rendered by default.

606 changes: 606 additions & 0 deletions examples/kind-quickstart/02-Client.ipynb

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions examples/kind-quickstart/03-Uninstall.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Uninstall deployment\n",
"Use Helm to uninstall all the previous deployments"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"release \"feast-online\" uninstalled\n",
"release \"feast-offline\" uninstalled\n",
"release \"feast-registry\" uninstalled\n",
"NAME\tNAMESPACE\tREVISION\tUPDATED\tSTATUS\tCHART\tAPP VERSION\n"
]
}
],
"source": [
"!helm uninstall feast-online\n",
"!helm uninstall feast-offline\n",
"!helm uninstall feast-registry\n",
"!helm list"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Delete the PostgreSQL deployment."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"secret \"postgres-secret\" deleted\n",
"persistentvolume \"postgres-volume\" deleted\n",
"persistentvolumeclaim \"postgres-volume-claim\" deleted\n",
"deployment.apps \"postgres\" deleted\n",
"service \"postgres\" deleted\n"
]
}
],
"source": [
"!kubectl delete -f postgres/postgres.yaml"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No resources found in feast namespace.\n",
"No resources found in feast namespace.\n",
"NAME READY STATUS RESTARTS AGE\n",
"feast-apply-job-tzscd 0/1 Completed 0 2m40s\n"
]
}
],
"source": [
"!kubectl get svc\n",
"!kubectl get deployments\n",
"!kubectl get pods"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "feast3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
7 changes: 7 additions & 0 deletions examples/kind-quickstart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Install and run Feast with Kind

The following notebooks will guide you through an end-to-end journey to install and validate a simple Feast feature store in a
Kind Kubernetes cluster:
* [01-Install.ipynb](./01-Install.ipynb): Install and configure the cluster, then the Feast components.
* [02-Client.ipynb](./02-Client.ipynb): Validate the feature store with a remote test application runnning on the notebook.
* [03-Uninstall.ipynb](./03-Uninstall.ipynb): Clear the installed deployments.
Empty file.
14 changes: 14 additions & 0 deletions examples/kind-quickstart/client/feature_store.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
project: sample
registry:
path: localhost:8001
registry_type: remote
offline_store:
host: localhost
port: 8002
type: remote
online_store:
path: http://localhost:8003
type: remote
entity_key_serialization_version: 2
auth:
type: no_auth
31 changes: 31 additions & 0 deletions examples/kind-quickstart/init-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: batch/v1
kind: Job
metadata:
name: feast-apply-job
spec:
template:
spec:
containers:
- name: feast-apply
image: feastdev/feature-server:0.40.1
command: ["/bin/sh", "-c"]
args:
- |
echo "Starting feast initialization job...";
mkdir /tmp/sample;
cd /tmp/sample;
cp /sample/* .;
sed -i 's/localhost/postgres/' feature_store.yaml;
feast apply;
CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S");
feast materialize-incremental $CURRENT_TIME;
echo "Feast initialization completed successfully.";
volumeMounts:
- name: sample-repo-files
mountPath: /sample
restartPolicy: Never
volumes:
- name: sample-repo-files
configMap:
name: sample-repo
backoffLimit: 1
83 changes: 83 additions & 0 deletions examples/kind-quickstart/postgres/postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#https://www.digitalocean.com/community/tutorials/how-to-deploy-postgres-to-kubernetes-cluster
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
labels:
app: postgres
stringData:
POSTGRES_DB: feast
POSTGRES_USER: feast
POSTGRES_PASSWORD: feast
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-volume
labels:
type: local
app: postgres
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data/postgresql
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-volume-claim
labels:
app: postgres
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: 'postgres:15-alpine'
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: postgres-secret
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgresdata
volumes:
- name: postgresdata
persistentVolumeClaim:
claimName: postgres-volume-claim
---
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: postgres
spec:
type: NodePort
ports:
- port: 5432
selector:
app: postgres
Empty file.
12 changes: 12 additions & 0 deletions examples/kind-quickstart/src/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess

def port_forward(service, external_port, local_port=80) :
"""
Run a background process to forward port 80 of the given `service` service to the given `external_port` port.

Returns: the process instance
"""
command = ["kubectl", "port-forward", f"service/{service}", f"{external_port}:{local_port}"]
process = subprocess.Popen(command)
print(f"Port-forwarding {service} with process ID: {process.pid}")
return process
Loading