Skip to content

Commit e675cbd

Browse files
authored
docs: Example to install feast on local computer using Kind (feast-dev#4528)
* Simple deployment on Kind Signed-off-by: Daniele Martinoli <dmartino@redhat.com> * updated notebooks output Signed-off-by: Daniele Martinoli <dmartino@redhat.com> * added missing README Signed-off-by: Daniele Martinoli <dmartino@redhat.com> * typo Signed-off-by: Daniele Martinoli <dmartino@redhat.com> --------- Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
1 parent 0795496 commit e675cbd

File tree

10 files changed

+1805
-0
lines changed

10 files changed

+1805
-0
lines changed

examples/kind-quickstart/01-Install.ipynb

Lines changed: 932 additions & 0 deletions
Large diffs are not rendered by default.

examples/kind-quickstart/02-Client.ipynb

Lines changed: 606 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"## Uninstall deployment\n",
8+
"Use Helm to uninstall all the previous deployments"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 10,
14+
"metadata": {},
15+
"outputs": [
16+
{
17+
"name": "stdout",
18+
"output_type": "stream",
19+
"text": [
20+
"release \"feast-online\" uninstalled\n",
21+
"release \"feast-offline\" uninstalled\n",
22+
"release \"feast-registry\" uninstalled\n",
23+
"NAME\tNAMESPACE\tREVISION\tUPDATED\tSTATUS\tCHART\tAPP VERSION\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"!helm uninstall feast-online\n",
29+
"!helm uninstall feast-offline\n",
30+
"!helm uninstall feast-registry\n",
31+
"!helm list"
32+
]
33+
},
34+
{
35+
"cell_type": "markdown",
36+
"metadata": {},
37+
"source": [
38+
"Delete the PostgreSQL deployment."
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": 11,
44+
"metadata": {},
45+
"outputs": [
46+
{
47+
"name": "stdout",
48+
"output_type": "stream",
49+
"text": [
50+
"secret \"postgres-secret\" deleted\n",
51+
"persistentvolume \"postgres-volume\" deleted\n",
52+
"persistentvolumeclaim \"postgres-volume-claim\" deleted\n",
53+
"deployment.apps \"postgres\" deleted\n",
54+
"service \"postgres\" deleted\n"
55+
]
56+
}
57+
],
58+
"source": [
59+
"!kubectl delete -f postgres/postgres.yaml"
60+
]
61+
},
62+
{
63+
"cell_type": "code",
64+
"execution_count": 12,
65+
"metadata": {},
66+
"outputs": [
67+
{
68+
"name": "stdout",
69+
"output_type": "stream",
70+
"text": [
71+
"No resources found in feast namespace.\n",
72+
"No resources found in feast namespace.\n",
73+
"NAME READY STATUS RESTARTS AGE\n",
74+
"feast-apply-job-tzscd 0/1 Completed 0 2m40s\n"
75+
]
76+
}
77+
],
78+
"source": [
79+
"!kubectl get svc\n",
80+
"!kubectl get deployments\n",
81+
"!kubectl get pods"
82+
]
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": null,
87+
"metadata": {},
88+
"outputs": [],
89+
"source": []
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": null,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": []
97+
}
98+
],
99+
"metadata": {
100+
"kernelspec": {
101+
"display_name": "feast3.11",
102+
"language": "python",
103+
"name": "python3"
104+
},
105+
"language_info": {
106+
"codemirror_mode": {
107+
"name": "ipython",
108+
"version": 3
109+
},
110+
"file_extension": ".py",
111+
"mimetype": "text/x-python",
112+
"name": "python",
113+
"nbconvert_exporter": "python",
114+
"pygments_lexer": "ipython3",
115+
"version": "3.11.9"
116+
}
117+
},
118+
"nbformat": 4,
119+
"nbformat_minor": 2
120+
}

examples/kind-quickstart/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Install and run Feast with Kind
2+
3+
The following notebooks will guide you through an end-to-end journey to install and validate a simple Feast feature store in a
4+
Kind Kubernetes cluster:
5+
* [01-Install.ipynb](./01-Install.ipynb): Install and configure the cluster, then the Feast components.
6+
* [02-Client.ipynb](./02-Client.ipynb): Validate the feature store with a remote test application runnning on the notebook.
7+
* [03-Uninstall.ipynb](./03-Uninstall.ipynb): Clear the installed deployments.

examples/kind-quickstart/client/__init__.py

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
project: sample
2+
registry:
3+
path: localhost:8001
4+
registry_type: remote
5+
offline_store:
6+
host: localhost
7+
port: 8002
8+
type: remote
9+
online_store:
10+
path: http://localhost:8003
11+
type: remote
12+
entity_key_serialization_version: 2
13+
auth:
14+
type: no_auth
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: feast-apply-job
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: feast-apply
10+
image: feastdev/feature-server:0.40.1
11+
command: ["/bin/sh", "-c"]
12+
args:
13+
- |
14+
echo "Starting feast initialization job...";
15+
mkdir /tmp/sample;
16+
cd /tmp/sample;
17+
cp /sample/* .;
18+
sed -i 's/localhost/postgres/' feature_store.yaml;
19+
feast apply;
20+
CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S");
21+
feast materialize-incremental $CURRENT_TIME;
22+
echo "Feast initialization completed successfully.";
23+
volumeMounts:
24+
- name: sample-repo-files
25+
mountPath: /sample
26+
restartPolicy: Never
27+
volumes:
28+
- name: sample-repo-files
29+
configMap:
30+
name: sample-repo
31+
backoffLimit: 1
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#https://www.digitalocean.com/community/tutorials/how-to-deploy-postgres-to-kubernetes-cluster
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: postgres-secret
6+
labels:
7+
app: postgres
8+
stringData:
9+
POSTGRES_DB: feast
10+
POSTGRES_USER: feast
11+
POSTGRES_PASSWORD: feast
12+
---
13+
apiVersion: v1
14+
kind: PersistentVolume
15+
metadata:
16+
name: postgres-volume
17+
labels:
18+
type: local
19+
app: postgres
20+
spec:
21+
capacity:
22+
storage: 1Gi
23+
accessModes:
24+
- ReadWriteOnce
25+
hostPath:
26+
path: /data/postgresql
27+
---
28+
apiVersion: v1
29+
kind: PersistentVolumeClaim
30+
metadata:
31+
name: postgres-volume-claim
32+
labels:
33+
app: postgres
34+
spec:
35+
accessModes:
36+
- ReadWriteOnce
37+
resources:
38+
requests:
39+
storage: 1Gi
40+
---
41+
apiVersion: apps/v1
42+
kind: Deployment
43+
metadata:
44+
name: postgres
45+
spec:
46+
replicas: 1
47+
selector:
48+
matchLabels:
49+
app: postgres
50+
template:
51+
metadata:
52+
labels:
53+
app: postgres
54+
spec:
55+
containers:
56+
- name: postgres
57+
image: 'postgres:15-alpine'
58+
imagePullPolicy: IfNotPresent
59+
ports:
60+
- containerPort: 5432
61+
envFrom:
62+
- secretRef:
63+
name: postgres-secret
64+
volumeMounts:
65+
- mountPath: /var/lib/postgresql/data
66+
name: postgresdata
67+
volumes:
68+
- name: postgresdata
69+
persistentVolumeClaim:
70+
claimName: postgres-volume-claim
71+
---
72+
apiVersion: v1
73+
kind: Service
74+
metadata:
75+
name: postgres
76+
labels:
77+
app: postgres
78+
spec:
79+
type: NodePort
80+
ports:
81+
- port: 5432
82+
selector:
83+
app: postgres

examples/kind-quickstart/src/__init__.py

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import subprocess
2+
3+
def port_forward(service, external_port, local_port=80) :
4+
"""
5+
Run a background process to forward port 80 of the given `service` service to the given `external_port` port.
6+
7+
Returns: the process instance
8+
"""
9+
command = ["kubectl", "port-forward", f"service/{service}", f"{external_port}:{local_port}"]
10+
process = subprocess.Popen(command)
11+
print(f"Port-forwarding {service} with process ID: {process.pid}")
12+
return process

0 commit comments

Comments
 (0)