Jeff
Jeff

Reputation: 9

Qdrant Azure private cloud API KEY setup setting not found

I recently had deployed qdrant onto a AKS Cluster by following this documentation (https://github.com/Azure-Samples/qdrant-azure/blob/main/Azure-Kubernetes-Svc/README.md) and everything is working as expected. However, I noticed that I do not need to input an API Key to access or edit my database. However, I do not have any idea where I can implement this setting.

I first attempted to create a secret instance within AKS and bind it to the StatefulSet, however, that did not seem to do the trick. And after reading a bunch of official documentations, it seems like the only ways to setup an API KEY is either by creating the cluster on the Qdrant Cloud website or by enabling API KEY in the QdrantClusterSetting.yaml. Both these seeme irrelevant in my current state. Is enabling API Key on AKS possible to achieve? Thanks in advance.

Upvotes: 0

Views: 171

Answers (1)

Arko
Arko

Reputation: 3816

To set up Qdrant on AKS with API key authentication enabled, deploy Qdrant using a StatefulSet

kubectl create secret generic qdrant-api-key-secret --from-literal=api-key=b//ZtUPcPLY2i5ktrqdZ0EUvstHkeezHjAQCK6aamRQ= -n qdrant

Deploy Qdrant with StatefulSet

apiVersion: v1
kind: Service
metadata:
  name: qdrant
  namespace: qdrant
spec:
  ports:
    - port: 6333
      targetPort: 6333
      protocol: TCP
  clusterIP: None
  selector:
    app: qdrant
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: qdrant
  namespace: qdrant
spec:
  serviceName: "qdrant"
  replicas: 1
  selector:
    matchLabels:
      app: qdrant
  template:
    metadata:
      labels:
        app: qdrant
    spec:
      containers:
      - name: qdrant
        image: qdrant/qdrant:v1.2.0
        ports:
        - containerPort: 6333
          name: qdrant
        env:
        - name: QDRANT__SERVICE__API_KEY
          valueFrom:
            secretKeyRef:
              name: qdrant-api-key-secret
              key: api-key
        volumeMounts:
        - name: qdrant-data
          mountPath: /qdrant/storage
      volumes:
      - name: qdrant-data
        persistentVolumeClaim:
          claimName: qdrant-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qdrant-pvc
  namespace: qdrant
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi

Expose Qdrant via load balancer

apiVersion: v1
kind: Service
metadata:
  name: qdrant-loadbalancer
  namespace: qdrant
spec:
  selector:
    app: qdrant
  ports:
  - protocol: TCP
    port: 80
    targetPort: 6333
  type: LoadBalancer

enter image description here

Get the external IP of the Qdrant service

kubectl get service qdrant-loadbalancer -n qdrant

enter image description here

To verify that Qdrant is accessible and API key authentication is working, make an HTTP request to the external IP with your API key

curl -H "API-Key: b//ZtUPcPLY2i5ktrqdZ0EUvstHkeezHjAQCK6aamRQ=" http://4.236.219.119:80

enter image description here

If everything is set up correctly, you'll receive a response from Qdrant similar to below-

enter image description here

Upvotes: 0

Related Questions