-
Notifications
You must be signed in to change notification settings - Fork 5
/
faiss-server-k8s-example-stateful.yaml
58 lines (58 loc) · 1.5 KB
/
faiss-server-k8s-example-stateful.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# For deploying to Kubernetes
apiVersion: v1
kind: Service
metadata:
name: faiss-server
namespace: YOUR_K8S_NAMESPACE (eg. development or production)
labels:
app: faiss-server
spec:
type: NodePort
ports:
- name: grpc-faiss-server
port: 50051
targetPort: 50051
protocol: TCP
selector:
app: faiss-server
---
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
apiVersion: apps/v1
# Note that we use `StatefulSet` to access the specific faiss-server POD instead of random.
# For example, you can access the specific faiss-server among 2 replicas as the below:
# HOST1: faiss-server-0.faiss-server.production
# PORT1: 50051
# HOST2: faiss-server-1.faiss-server.production
# PORT2: 50051
kind: StatefulSet
metadata:
name: faiss-server
namespace: YOUR_K8S_NAMESPACE (eg. development or production)
labels:
app: faiss-server
spec:
serviceName: faiss-server
replicas: 2
selector:
matchLabels:
app: faiss-server
template:
metadata:
labels:
app: faiss-server
spec:
containers:
- name: faiss-server
image: YOUR_DOCKER_CONTAINER_REGISTRY/faiss-server:YOUR_VERSION
imagePullPolicy: Always
command: ["python", "server.py"]
args: [
"--dim", "528",
"--max_workers", "10",
"--num_threads", "10"
]
ports:
- containerPort: 50051
imagePullSecrets:
# Your docker container registry auth
- name: acr-auth