From 7e0a240756146eec69741aa1cceecd335cf46b40 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Sun, 5 May 2024 20:37:00 +1000 Subject: [PATCH] Add qrant vector database --- adhoc-config/qdrant-local-pv.yaml | 41 +++++++++++++ db/qdrant.yaml | 99 +++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 adhoc-config/qdrant-local-pv.yaml create mode 100644 db/qdrant.yaml diff --git a/adhoc-config/qdrant-local-pv.yaml b/adhoc-config/qdrant-local-pv.yaml new file mode 100644 index 0000000..40ead25 --- /dev/null +++ b/adhoc-config/qdrant-local-pv.yaml @@ -0,0 +1,41 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: qdrant-local-pv + labels: + type: local + name: qdrant +spec: + capacity: + storage: 20Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Delete + storageClassName: local-storage + local: + path: /mnt/k8s/qdrant + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - server-3 + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: db + name: qdrant-local-pvc +spec: + volumeName: qdrant-local-pv + storageClassName: "local-storage" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi diff --git a/db/qdrant.yaml b/db/qdrant.yaml new file mode 100644 index 0000000..039ac36 --- /dev/null +++ b/db/qdrant.yaml @@ -0,0 +1,99 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: qdrant +spec: + replicas: 1 + selector: + matchLabels: + app: qdrant + template: + metadata: + labels: + app: qdrant + spec: + nodeSelector: + kubernetes.io/hostname: server-3 + tolerations: + - key: "node" + operator: "Equal" + value: "special" + effect: "NoSchedule" + - key: node-role.kubernetes.io/master + operator: Equal + value: "" + effect: NoSchedule + - key: node-role.kubernetes.io/control-plane + operator: Equal + value: "" + effect: NoSchedule + containers: + - name: qdrant + image: ghcr.io/qdrant/qdrant/qdrant:v1.9.1-unprivileged + ports: + - containerPort: 6333 + - containerPort: 6334 + env: + - name: TZ + value: "Australia/Melbourne" + - name: QDRANT__SERVICE__ENABLE_TLS + value: "0" + - name: QDRANT__LOG_LEVEL + value: INFO + volumeMounts: + - name: data + mountPath: "/qdrant/storage" + resources: + limits: + cpu: "1" + memory: "1Gi" + requests: + cpu: "400m" + memory: "256Mi" + securityContext: + privileged: false + runAsGroup: 1000 + # fsGroup: 1000 + runAsUser: 1000 + volumes: + - name: data + persistentVolumeClaim: + claimName: qdrant-local-pvc + +--- +apiVersion: v1 +kind: Service +metadata: + name: qdrant-adguard + namespace: db + annotations: + metallb.universe.tf/loadBalancerIPs: 192.168.1.202 +spec: + selector: + app: qdrant + ports: + - protocol: TCP + port: 6333 + targetPort: 6333 + - protocol: TCP + port: 6334 + targetPort: 6334 + type: LoadBalancer + externalIPs: + - 192.168.1.202 + +--- +apiVersion: v1 +kind: Service +metadata: + name: qdrant +spec: + selector: + app: qdrant + ports: + - protocol: TCP + port: 6333 + targetPort: 6333 + - protocol: TCP + port: 6334 + targetPort: 6334