Self-Hosted Qdrant on Kubernetes

Self-hosted Qdrant on Kubernetes.

Each self-hosted vectorstore gets its own Qdrant server: a StatefulSet of one replica, with a persistent volume for its data and snapshots, a ClusterIP Service, and a Secret with its API key. They are applied, observed and deleted with KubernetesHelper, and labeled smarter.sh/vectorstore: <name>, so that they can be selected together.

The Qdrant image is the unprivileged variant, which runs as a non-root user.

class smarter.apps.vectorstore.kubernetes.QdrantKubernetes(vectorstore, kubernetes=None)[source]

Bases: object

The Kubernetes resources of a self-hosted Qdrant server.

__init__(vectorstore, kubernetes=None)[source]
apply(api_key)[source]

Create or update the Qdrant server’s resources.

Return type:

None

destroy()[source]

Delete the Qdrant server and its volume.

Its data is lost.

Return type:

bool

property endpoint: str

The Qdrant server’s URL, inside the cluster.

property labels: dict[str, str]
logs(tail=200)[source]
Return type:

Optional[str]

observe()[source]

Whether the Qdrant server exists, and is ready.

Return type:

QdrantObservation

render(api_key)[source]

The Secret, Service and StatefulSet of the Qdrant server.

Return type:

list[dict[str, Any]]

stop()[source]

Delete the Qdrant server, but not its volume, so that its data survives.

Return type:

bool

class smarter.apps.vectorstore.kubernetes.QdrantObservation(exists, ready, message)[source]

Bases: object

The state of a self-hosted Qdrant server.

__init__(exists, ready, message)
exists: bool
message: str
ready: bool
exception smarter.apps.vectorstore.kubernetes.VectorstoreKubernetesError(message='')[source]

Bases: SmarterException

The Kubernetes cluster is unavailable, or rejected a self-hosted vectorstore’s resources.

smarter.apps.vectorstore.kubernetes.configure_kubernetes(factory)[source]

Use another KubernetesHelper, e.g. a fake in tests.

None restores the default.

Return type:

None

smarter.apps.vectorstore.kubernetes.get_kubernetes()[source]
Return type:

KubernetesHelper