Skip to content
Vector database engineering on Kubernetes · Chapter 7 of 20 Day 6: High availability – when a building closes

Day 6: High availability – when a building closes

Goal: understand the rules by which Kubernetes places and protects the Qdrant pods, and measure what search does during planned and unplanned failures – from a deleted pod to a node that no longer responds · Duration: about 120 min · Prerequisite: Day 0 to Day 5

State before this chapter

Qdrant runs with three pods, one each on vdb2, vdb3 and vdb4. The collection doku has one shard with two copies, verteilt has three shards with two copies each.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (excerpt – three pods Running on three nodes; your IPs will differ):

NAME       READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          97m   10.42.1.22   vdb2   <none>           <none>
qdrant-1   1/1     Running   0          90m   10.42.3.13   vdb4   <none>           <none>
qdrant-2   1/1     Running   0          89m   10.42.2.12   vdb3   <none>           <none>
# on vdb1
helm -n qdrant list

Expected (excerpt – revision 5 from Day 5):

NAME    NAMESPACE   REVISION    UPDATED                                 STATUS      CHART           APP VERSION
qdrant  qdrant      5           2026-12-05 09:52:02.005319525 +0000 UTC deployed    qdrant-1.20.3   v1.20.3    

Introduction

Yesterday you proved that every shard has a second copy on another node. That is half of high availability. The other half is decided by Kubernetes: where a pod may go, how many pods may be gone at the same time, and what happens when a node disappears.

These rules often behave differently than you would think. A rule that keeps pods apart leaves a fourth pod waiting forever. A kubectl drain stops at a point you did not set. And when a node fails hard, Kubernetes does not simply restart the Qdrant pod elsewhere – on purpose.

Today you will learn:

  • to read why a pod stays in state Pending, and to tell anti-affinity from topology spread,
  • to set a PodDisruptionBudget via Helm and see how it stops a second drain,
  • to measure with a read prober whether search notices a failure at all,
  • to delete a pod normally and by force,
  • to let a worker fail hard and follow the sequence of events in Kubernetes,
  • to confirm with the taint node.kubernetes.io/out-of-service that a node really is off.

Background

The picture of the day: when a building closes

The city library has three buildings. They are subject to house rules enforced by headquarters (Kubernetes):

  • Never two branches under one roof (pod anti-affinity). If a building fails, the library loses only one branch. If there are only three buildings, a fourth branch gets no space.
  • Spread evenly (topology spread). No building may hold more than one branch more than the emptiest one. A fourth branch may then move in with another one.
  • At most one branch closed for renovation at a time (PodDisruptionBudget). The rule applies to announced closures, not to a burst water pipe.
  • Announce a renovation (kubectl drain): headquarters closes the branches in the building one after the other and asks for each whether the house rule allows it.
  • Branch unreachable (node NotReady): the phone is dead. Headquarters does not know whether someone inside is still rearranging books. It therefore does not open a second branch with the same holdings until someone confirms that the old one really is closed (taint out-of-service).

The terms

Term Meaning In the picture
podAntiAffinity (required) pod may not go on a node where a matching pod runs never two branches under one roof
topologySpreadConstraints spread pods evenly, maxSkew = allowed difference spread evenly across buildings
Pending pod does not have a node yet; the reason is in the events branch without a building
PodDisruptionBudget (PDB) how many pods a voluntary disruption may take at the same time at most one branch under renovation
kubectl drain lock a node (cordon) and clear out pods via eviction announce a renovation
Eviction deletion of a pod that a PDB checks – unlike kubectl delete closure with a check-back
Taint unreachable set by Kubernetes when a node no longer reports in phone dead
Taint out-of-service set by a human: the node really is off confirmation: branch is closed

Remember: the house rules protect against what you plan. For what you don’t plan, you need the second copies from Day 5 – and a confirmation before a replacement opens.

Drill 1: The fourth pod

Where you are: on vdb1.

What you have afterwards: proof that the anti-affinity from Day 5 allows only one pod per node.

Step 1 – look up the rule. On Day 5 you set an anti-affinity in the Helm values. You read it directly from the StatefulSet, that is, the way Kubernetes sees it.

# on vdb1
kubectl -n qdrant get statefulset qdrant -o jsonpath='{.spec.template.spec.affinity}'
  • -o jsonpath='…' outputs only the field selected by the expression.
  • {.spec.template.spec.affinity} is the path to the affinity in the StatefulSet’s pod template.

Expected:

{"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"labelSelector":{"matchLabels":{"app.kubernetes.io/name":"qdrant"}},"topologyKey":"kubernetes.io/hostname"}]}}

What you see: required… means mandatory, not a wish. topologyKey: kubernetes.io/hostname makes every node a domain of its own. A pod with the label app.kubernetes.io/name: qdrant may therefore not go on any node where such a pod is already running.

Step 2 – demand a fourth pod. You briefly scale the StatefulSet to four by hand. This is an experiment: Helm knows nothing about it, and you undo it in Step 5.

# on vdb1
kubectl -n qdrant scale statefulset qdrant --replicas=4
  • scale statefulset qdrant changes the number of pods of the StatefulSet qdrant.
  • --replicas=4 is the new number.

Expected:

statefulset.apps/qdrant scaled

Step 3 – look at the new pod.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected:

NAME       READY   STATUS    RESTARTS   AGE   IP           NODE     NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          97m   10.42.1.22   vdb2     <none>           <none>
qdrant-1   1/1     Running   0          90m   10.42.3.13   vdb4     <none>           <none>
qdrant-2   1/1     Running   0          89m   10.42.2.12   vdb3     <none>           <none>
qdrant-3   0/1     Pending   0          22s   <none>       <none>   <none>           <none>

What you see: qdrant-3 has no node (NODE <none>) and stays Pending.

Step 4 – read the reason. The scheduler writes the reason for Pending as an event on the pod.

# on vdb1
kubectl -n qdrant get events --field-selector involvedObject.name=qdrant-3
  • get events lists the events in the namespace.
  • --field-selector involvedObject.name=qdrant-3 shows only the events for the pod qdrant-3.

Expected (for us the second message only came about ten minutes later – repeat the command until it appears):

LAST SEEN   TYPE      REASON             OBJECT         MESSAGE
16m         Warning   FailedScheduling   pod/qdrant-3   0/4 nodes are available: pod has unbound immediate PersistentVolumeClaims. not found
16m         Warning   FailedScheduling   pod/qdrant-3   0/4 nodes are available: pod has unbound immediate PersistentVolumeClaims. not found
5m49s       Warning   FailedScheduling   pod/qdrant-3   0/4 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 3 node(s) didn't match pod anti-affinity rules. preemption: 0/4 nodes are available: 1 Preemption is not helpful for scheduling, 3 No preemption victims found for incoming pod.

What you see: the first two messages are an intermediate state. The StatefulSet creates a PVC for the new pod, and Longhorn needed a moment to bind it. The third message is the real reason and counts off every node:

Part of the message Meaning
0/4 nodes are available none of the four nodes fits
1 node(s) didn't match Pod's node affinity/selector vdb1 has no label vdb-rolle=daten
3 node(s) didn't match pod anti-affinity rules a Qdrant pod is already running on vdb2, vdb3 and vdb4
preemption: … No preemption victims found evicting other pods would not help either

One more look at the pod’s description – you will need one line again in Drill 5:

# on vdb1
kubectl -n qdrant describe pod qdrant-3

Expected (excerpt – look for the lines Node-Selectors and Tolerations):

Node-Selectors:              vdb-rolle=daten
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s

What you see: two tolerations that Kubernetes gives every pod: it tolerates a node that is not-ready or unreachable for 300 seconds. What happens after that, you measure in Drill 5.

Step 5 – back to three. You undo the experiment and delete the PVC that the StatefulSet created for qdrant-3. Kubernetes does not delete it on its own when scaling down.

# on vdb1
kubectl -n qdrant scale statefulset qdrant --replicas=3

Expected:

statefulset.apps/qdrant scaled
# on vdb1
kubectl -n qdrant delete pvc qdrant-storage-qdrant-3

Expected:

persistentvolumeclaim "qdrant-storage-qdrant-3" deleted from qdrant namespace

A quick look at whether the Qdrant cluster noticed anything of the experiment:

# on vdb1
curl -s http://10.43.151.237:6333/cluster -o c.json
# on vdb1
jq -c '.result | {peers: (.peers|length), raft: .raft_info.role}' c.json

Expected (raft may be Leader or Follower for you – depending on which pod answers):

{"peers":3,"raft":"Follower"}

What you see: three peers. qdrant-3 never started and therefore never joined the cluster.

Remember: a mandatory anti-affinity per node means: at most as many pods as matching nodes. You read the reason for Pending in the events – and the first message is not always the last.

Save your progress? Sign up for free

Drill 2: Repel or spread

Where you are: on vdb1.

What you have afterwards: both rules compared using harmless placeholder pods.

You don’t try this with Qdrant itself: every additional Qdrant pod would join the Raft cluster. Instead you use a Deployment with the image pause. It starts a container that does nothing – ideal for seeing only the behavior of the scheduler.

Step 1 – four placeholders with anti-affinity.

# on vdb1
mkdir -p ~/labor/tag06
# on vdb1
cd ~/labor/tag06
# on vdb1
nano platzhalter-abstossen.yaml
~/labor/tag06/platzhalter-abstossen.yaml new file
apiVersion: apps/v1
kind: Deployment
metadata:
  name: platzhalter
spec:
  replicas: 4
  selector:
    matchLabels:
      app: platzhalter
  template:
    metadata:
      labels:
        app: platzhalter
    spec:
      nodeSelector:
        vdb-rolle: daten
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  app: platzhalter
              topologyKey: kubernetes.io/hostname
      containers:
        - name: pause
          image: registry.k8s.io/pause:3.10
          resources:
            requests:
              cpu: 10m
              memory: 8Mi
Setting Value Meaning
replicas 4 four pods – one more than data nodes
nodeSelector vdb-rolle: daten only on vdb2, vdb3, vdb4 – like Qdrant
podAntiAffinity required, kubernetes.io/hostname the same rule as for Qdrant
image registry.k8s.io/pause:3.10 container that only sleeps
requests 10m, 8Mi so small that resources play no role
# on vdb1
kubectl apply -f platzhalter-abstossen.yaml

Expected:

deployment.apps/platzhalter created
# on vdb1
kubectl get pods -l app=platzhalter -o wide
  • -l app=platzhalter shows only pods with this label.

Expected (names and IPs will differ for you):

NAME                           READY   STATUS    RESTARTS   AGE   IP           NODE     NOMINATED NODE   READINESS GATES
platzhalter-76bd956cd8-24kp8   1/1     Running   0          22s   10.42.1.23   vdb2     <none>           <none>
platzhalter-76bd956cd8-kgfnw   1/1     Running   0          22s   10.42.3.14   vdb4     <none>           <none>
platzhalter-76bd956cd8-qh5kn   1/1     Running   0          22s   10.42.2.13   vdb3     <none>           <none>
platzhalter-76bd956cd8-ztvld   0/1     Pending   0          22s   <none>       <none>   <none>           <none>

What you see: the same picture as with Qdrant: three run, the fourth waits.

Step 2 – remove the Deployment. For the comparison you create it anew instead of switching it over. Why switching over gets stuck here is the diagnosis task at the end of the chapter.

# on vdb1
kubectl delete deployment platzhalter

Expected:

deployment.apps "platzhalter" deleted from default namespace

Step 3 – four placeholders with topology spread.

# on vdb1
nano platzhalter-verteilen.yaml
~/labor/tag06/platzhalter-verteilen.yaml changes in green
apiVersion: apps/v1
kind: Deployment
metadata:
  name: platzhalter
spec:
  replicas: 4
  selector:
    matchLabels:
      app: platzhalter
  template:
    metadata:
      labels:
        app: platzhalter
    spec:
      nodeSelector:
        vdb-rolle: daten
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: kubernetes.io/hostname
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels:
              app: platzhalter
      containers:
        - name: pause
          image: registry.k8s.io/pause:3.10
          resources:
            requests:
              cpu: 10m
              memory: 8Mi
Setting Value Meaning
maxSkew 1 at most one pod difference between the fullest and the emptiest node
topologyKey kubernetes.io/hostname each node is a domain
whenUnsatisfiable DoNotSchedule rather wait than break the rule (opposite: ScheduleAnyway)
labelSelector app: platzhalter which pods are counted
# on vdb1
kubectl apply -f platzhalter-verteilen.yaml

Expected:

deployment.apps/platzhalter created
# on vdb1
kubectl get pods -l app=platzhalter -o wide

Expected:

NAME                           READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
platzhalter-776f8cbbd6-2vc59   1/1     Running   0          22s   10.42.2.14   vdb3   <none>           <none>
platzhalter-776f8cbbd6-cwk27   1/1     Running   0          22s   10.42.3.15   vdb4   <none>           <none>
platzhalter-776f8cbbd6-h5lvf   1/1     Running   0          22s   10.42.1.24   vdb2   <none>           <none>
platzhalter-776f8cbbd6-hfrgh   1/1     Running   0          22s   10.42.1.25   vdb2   <none>           <none>

What you see: all four run, spread 2–1–1. The difference is exactly 1, so it is allowed.

Step 4 – increase to seven.

# on vdb1
kubectl scale deployment platzhalter --replicas=7

Expected:

deployment.apps/platzhalter scaled
# on vdb1
kubectl get pods -l app=platzhalter -o wide

Expected:

NAME                           READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
platzhalter-776f8cbbd6-2vc59   1/1     Running   0          40s   10.42.2.14   vdb3   <none>           <none>
platzhalter-776f8cbbd6-cwk27   1/1     Running   0          40s   10.42.3.15   vdb4   <none>           <none>
platzhalter-776f8cbbd6-h5lvf   1/1     Running   0          40s   10.42.1.24   vdb2   <none>           <none>
platzhalter-776f8cbbd6-hfrgh   1/1     Running   0          40s   10.42.1.25   vdb2   <none>           <none>
platzhalter-776f8cbbd6-jf7kp   1/1     Running   0          17s   10.42.1.26   vdb2   <none>           <none>
platzhalter-776f8cbbd6-mljzc   1/1     Running   0          17s   10.42.3.16   vdb4   <none>           <none>
platzhalter-776f8cbbd6-p8rgn   1/1     Running   0          17s   10.42.2.15   vdb3   <none>           <none>

What you see: 3–2–2. Topology spread keeps the distribution even, but allows several pods on one node.

Step 5 – clean up.

# on vdb1
kubectl delete deployment platzhalter

Expected:

deployment.apps "platzhalter" deleted from default namespace

For Qdrant, anti-affinity remains the right choice: two Qdrant pods on one node could both carry copies of the same shard – if the node fails, both would be gone. Topology spread fits stateless services that have more pods than nodes.

Remember: anti-affinity says “never together”, topology spread says “as equal as possible”. For database pods with copies you want “never together”.

Save your progress? Sign up for free

Drill 3: Renovation with a house rule

Where you are: on vdb1, with a second terminal on vdb1 for the prober.

What you have afterwards: a PodDisruptionBudget for Qdrant and the measurement of what a drain means for search.

Step 1 – the read prober. Whether a failure hits search is not visible in the pod list, but in requests. The small program runs a search four times per second and reports every change between “answers” and “error” with the time. At the end it counts answers and errors.

# on vdb1
nano lesen.py
~/labor/tag06/lesen.py new file
"""Fragt eine Collection viermal pro Sekunde ab und meldet jeden Wechsel zwischen Antwort und Fehler."""
import sys
import time

import numpy as np
from qdrant_client import QdrantClient

QDRANT, COLLECTION, SEKUNDEN = sys.argv[1], sys.argv[2], int(sys.argv[3])

vektor = np.load("../tag01/vektoren.npy")[0].tolist()
client = QdrantClient(url=QDRANT, timeout=2)

ok, fehler, zustand, seit = 0, 0, None, time.time()
ende = time.time() + SEKUNDEN
while time.time() < ende:
    try:
        client.query_points(COLLECTION, query=vektor, limit=5)
        ok += 1
        neu = "antwortet"
    except Exception as e:
        fehler += 1
        neu = "FEHLER: " + str(e).splitlines()[0][:90]
    if neu != zustand:
        dauer = f" (vorher {time.time() - seit:.1f} s)" if zustand else ""
        print(f"{time.strftime('%T')} {neu}{dauer}", flush=True)
        zustand, seit = neu, time.time()
    time.sleep(0.25)
print(f"{time.strftime('%T')} Ende: {ok} Antworten, {fehler} Fehler", flush=True)
  • The three arguments: address of Qdrant, collection, run time in seconds.
  • timeout=2: a request that hangs for longer than two seconds counts as an error.
  • The while loop is part of the program – you don’t type it as a command.

A short trial run through the Service:

# on vdb1
~/werkbank/bin/python lesen.py http://10.43.151.237:6333 doku 3

Expected:

11:34:11 antwortet
11:34:14 Ende: 12 Antworten, 0 Fehler

Step 2 – set the PodDisruptionBudget. The chart comes with a PDB, it is just switched off. You take the values from Day 5 and switch it on.

# on vdb1
cp ~/labor/tag05/qdrant-werte.yaml ~/labor/tag06/
# on vdb1
nano qdrant-werte.yaml
~/labor/tag06/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 3

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 1Gi
  limits:
    memory: 2Gi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

podDisruptionBudget:
  enabled: true
  maxUnavailable: 1
  • enabled: true makes the chart create a PDB.
  • maxUnavailable: 1 allows at most one Qdrant pod at a time to be missing because of an eviction.
# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
NAME: qdrant
LAST DEPLOYED: Sat Dec  5 11:53:46 2026
NAMESPACE: qdrant
STATUS: deployed
REVISION: 6
# on vdb1
kubectl -n qdrant get pdb

Expected:

NAME     MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
qdrant   N/A             1                 1                     2s

What you see: ALLOWED DISRUPTIONS 1 – one eviction is currently allowed. The pods do not restart for this, because the pod template has not changed.

Step 3 – start the prober. In the second terminal on vdb1:

# on vdb1, zweites Terminal
cd ~/labor/tag06
# on vdb1, zweites Terminal
~/werkbank/bin/python lesen.py http://10.43.151.237:6333 doku 150

It runs for two and a half minutes. Start Step 4 immediately afterwards in the first terminal.

Step 4 – clear out vdb4. kubectl drain locks the node for new pods and clears out the existing ones via eviction – that is, with a check-back to the PDB.

# on vdb1
kubectl drain vdb4 --ignore-daemonsets --delete-emptydir-data --timeout=120s
Setting Value Meaning
drain vdb4 lock and clear out the node
--ignore-daemonsets DaemonSet pods (Longhorn manager, CSI) stay; they belong to the node
--delete-emptydir-data also clear out pods with emptyDir volumes; their content is gone afterwards
--timeout 120s give up after two minutes instead of waiting forever

Expected (excerpt – look for the lines with qdrant and drained):

node/vdb4 cordoned
evicting pod qdrant/qdrant-1
pod/qdrant-1 evicted
node/vdb4 drained

In the first run we also saw this line in between – Longhorn protects its instance manager with its own PDB until the volumes have moved. The drain waited and retried every five seconds:

error when evicting pods/"instance-manager-db1675186fa4e592697a40bb174044ac" -n "longhorn-system" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.

Step 5 – where did qdrant-1 go?

# on vdb1
kubectl -n qdrant get pods

Expected:

NAME       READY   STATUS    RESTARTS   AGE
qdrant-0   1/1     Running   0          17m
qdrant-1   0/1     Pending   0          13s
qdrant-2   1/1     Running   0          5m37s

What you see: qdrant-1 is Pending – for the same reason as in Drill 1: vdb2 and vdb3 are occupied, vdb4 is locked. There is no free node. And the PDB now shows:

# on vdb1
kubectl -n qdrant get pdb

Expected (from our first run of this drill):

NAME     MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
qdrant   N/A             1                 0                     7m17s

Step 6 – try a second renovation. You clear out vdb3 while qdrant-1 is still missing.

# on vdb1
kubectl drain vdb3 --ignore-daemonsets --delete-emptydir-data --timeout=60s

Expected (excerpt – look for the lines with qdrant-2 and the end):

error when evicting pods/"qdrant-2" -n "qdrant" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
evicting pod qdrant/qdrant-2
error when evicting pods/"qdrant-2" -n "qdrant" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
There are pending nodes to be drained:
 vdb3
error when evicting pods/"qdrant-2" -n "qdrant": global timeout reached: 1m0s

What you see: the house rule takes effect. The drain tries for a minute and gives up. vdb3 stays locked (cordoned), though – you undo that right away.

Step 7 – lift the locks.

# on vdb1
kubectl uncordon vdb3

Expected:

node/vdb3 uncordoned
# on vdb1
kubectl uncordon vdb4

Expected:

node/vdb4 uncordoned
# on vdb1
kubectl -n qdrant wait --for=condition=Ready pod/qdrant-1 --timeout=180s

Expected:

pod/qdrant-1 condition met

In the first run, qdrant-1 was ready again 34 seconds after the uncordon.

Step 8 – what the prober saw. Once it has finished, the second terminal shows:

Expected:

12:31:12 antwortet
12:33:42 Ende: 563 Antworten, 0 Fehler

What you see: not a single error, although qdrant-1 was missing for a little over two minutes. doku has two copies, on qdrant-0 and qdrant-1 (Day 5). If one is missing, the other answers.

Remember: a PDB only protects against evictions – against drain, not against a crash. And a drain with anti-affinity and no free node means: the pod waits until you give the node back.

Save your progress? Sign up for free

Drill 4: A pod dies

Where you are: on vdb1, with the prober in the second terminal.

What you have afterwards: the measurement for a normal and a forced pod restart.

Step 1 – start the prober, delete the pod. In the second terminal:

# on vdb1, zweites Terminal
~/werkbank/bin/python lesen.py http://10.43.151.237:6333 doku 60

In the first terminal, a few seconds later:

# on vdb1
kubectl -n qdrant delete pod qdrant-0

Expected:

pod "qdrant-0" deleted from qdrant namespace
# on vdb1
kubectl -n qdrant wait --for=condition=Ready pod/qdrant-0 --timeout=120s

Expected:

pod/qdrant-0 condition met

For us the deletion took five seconds (12:13:57 to 12:14:02); another 20 seconds passed until the new pod was ready.

Expected in the second terminal:

12:13:51 antwortet
12:14:52 Ende: 223 Antworten, 0 Fehler

What you see: no error. A pod that is being terminated drops out of the Service, and the second copy of doku answers.

Step 2 – by force, on the distributed collection. --grace-period=0 --force deletes the pod from the API without waiting for the container to end. This time the prober reads verteilt – three shards, two copies each. In the second terminal:

# on vdb1, zweites Terminal
~/werkbank/bin/python lesen.py http://10.43.151.237:6333 verteilt 60

In the first terminal:

# on vdb1
kubectl -n qdrant delete pod qdrant-1 --grace-period=0 --force
  • --grace-period=0 gives the container no time to shut down cleanly.
  • --force removes the pod from the API immediately, even if the node has not confirmed the end.

Expected:

Warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "qdrant-1" force deleted from qdrant namespace

What you see: take the warning literally: Kubernetes has forgotten the pod; whether the container is still running, it does not know. Here the node is running normally, so it cleans up. With a dead node this is exactly what is dangerous – more on that shortly.

# on vdb1
kubectl -n qdrant wait --for=condition=Ready pod/qdrant-1 --timeout=120s

Expected:

pod/qdrant-1 condition met

Expected in the second terminal:

12:15:24 antwortet
12:16:24 Ende: 223 Antworten, 0 Fehler

Remember: a deleted pod is the easiest failure: Kubernetes knows about it and restarts it. With two copies per shard, search notices nothing.

Save your progress? Sign up for free

Drill 5: A building no longer answers

Where you are: on vdb1 and vdb3, with the prober in the second terminal.

What you have afterwards: the sequence of a hard worker failure in Kubernetes, minute by minute.

Letting a node fail without shutting down the VM: the script k3s-killall.sh that comes with k3s stops the agent and all containers on the node and tears down its pod network. To the cluster this looks like a node that suddenly falls silent.

Step 1 – prober for eight minutes. In the second terminal:

# on vdb1, zweites Terminal
~/werkbank/bin/python lesen.py http://10.43.151.237:6333 verteilt 470

Step 2 – stop vdb3 hard. In a terminal on vdb3:

# on vdb3
date +%T
# on vdb3
sudo /usr/local/bin/k3s-killall.sh

The script takes a while. For us it ran from 12:16:55 to 12:19:01.

Step 3 – what Kubernetes sees. Back on vdb1:

# on vdb1
kubectl get node vdb3

Expected:

NAME   STATUS     ROLES    AGE   VERSION
vdb3   NotReady   <none>   20h   v1.37.3+k3s1
# on vdb1
kubectl -n qdrant get pod qdrant-2 -o wide

Expected:

NAME       READY   STATUS    RESTARTS   AGE    IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-2   1/1     Running   0          133m   10.42.2.12   vdb3   <none>           <none>

What you see: the node is NotReady, yet the pod still shows Running 1/1. This is not a display error: this is the state vdb3 last reported, and since then it has reported nothing.

Step 4 – read the taints.

# on vdb1
kubectl get node vdb3 -o jsonpath='{range .spec.taints[*]}{.key}:{.effect} {.timeAdded}{"\n"}{end}'
  • {range .spec.taints[*]} … {end} iterates over all taints of the node.
  • For each taint, the expression outputs key, effect and time, then a line break.

Expected:

node.kubernetes.io/unreachable:NoSchedule 2026-12-05T12:17:46Z
node.kubernetes.io/unreachable:NoExecute 2026-12-05T12:17:46Z

What you see: 51 seconds after the script started, Kubernetes marked the node as unreachable. NoSchedule keeps new pods away. NoExecute starts the clock for the pods on the node: you know the toleration from Drill 1 – every pod tolerates unreachable for 300 seconds. After that, Kubernetes marks it for deletion.

Step 5 – after a little over five minutes.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (for us at 12:25 – if qdrant-2 still shows Running for you, wait and repeat the command):

NAME       READY   STATUS        RESTARTS   AGE     IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running       0          11m     10.42.1.34   vdb2   <none>           <none>
qdrant-1   1/1     Running       0          9m57s   10.42.3.19   vdb4   <none>           <none>
qdrant-2   1/1     Terminating   0          139m    10.42.2.12   vdb3   <none>           <none>

What you see: and there it stays. Terminating means: Kubernetes wants to delete the pod, but is waiting for confirmation from the kubelet on vdb3 – and that is silent. A StatefulSet does not start a second qdrant-2 as long as the first one is not confirmed gone. Two pods with the same identity and the same volume would be worse than one that is missing.

Step 6 – what the prober saw.

Expected in the second terminal:

12:16:50 antwortet
12:24:40 Ende: 1747 Antworten, 0 Fehler

What you see: eight minutes, no error – the other copies of the shards answered. The script stops the services one after the other and took two minutes here. Whether a real power cut, where everything disappears in the same instant, runs just as error-free is not measured by this experiment.

Remember: in a hard failure, Kubernetes does not restart a StatefulSet pod, but waits – on purpose. During that time, availability comes from the second copies alone.

Save your progress? Sign up for free

Drill 6: Confirming that the building is closed

Where you are: on vdb1 and vdb3.

What you have afterwards: the taint out-of-service applied, its effect seen and the node brought back.

If a node is waiting for a technician, a human can confirm to Kubernetes that the node really is off. That is what the taint node.kubernetes.io/out-of-service is for. It allows Kubernetes to finally delete the pods on the node and release their volumes. Only set it if you are sure that nothing is running on the node anymore – otherwise two pods may end up writing to the same data.

Step 1 – set the taint.

# on vdb1
kubectl taint nodes vdb3 node.kubernetes.io/out-of-service=nodeshutdown:NoExecute
Setting Value Meaning
taint nodes vdb3 set a taint on vdb3
Key node.kubernetes.io/out-of-service the agreed name that Kubernetes knows
Value nodeshutdown freely selectable, nodeshutdown is common
Effect NoExecute pods without a matching toleration must leave the node

Expected:

node/vdb3 tainted

Step 2 – the effect. Half a minute later:

# on vdb1
kubectl -n qdrant get pods -o wide

Expected:

NAME       READY   STATUS    RESTARTS   AGE   IP           NODE     NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          12m   10.42.1.34   vdb2     <none>           <none>
qdrant-1   1/1     Running   0          10m   10.42.3.19   vdb4     <none>           <none>
qdrant-2   0/1     Pending   0          17s   <none>       <none>   <none>           <none>

What you see: the old qdrant-2 is gone, the StatefulSet has created a new one – and it is Pending. The events tell you why:

# on vdb1
kubectl -n qdrant get events --field-selector involvedObject.name=qdrant-2 --sort-by=.lastTimestamp
  • --sort-by=.lastTimestamp sorts by the last occurrence; the newest is at the bottom.

Expected (excerpt – the last lines):

18s         Warning   FailedScheduling       pod/qdrant-2   0/4 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had untolerated taint(s), 2 node(s) didn't match pod anti-affinity rules. preemption: 0/4 nodes are available: 2 No preemption victims found for incoming pod, 2 Preemption is not helpful for scheduling.
8m30s       Warning   NodeNotReady           pod/qdrant-2   Node is not ready
33s         Normal    TaintManagerEviction   pod/qdrant-2   Marking for deletion Pod qdrant/qdrant-2

What you see: the calculation from Drill 1, just with one node fewer: vdb1 does not fit, vdb3 has the taint, vdb2 and vdb4 are occupied because of the anti-affinity. With three data nodes for three Qdrant pods there is no spare slot. The taint released the old pod, but it does not create a new slot.

Step 3 – the volume. Longhorn has detached the volume of qdrant-2 from the dead node:

# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io -o custom-columns=NAME:.metadata.name,STATE:.status.state,NODE:.status.currentNodeID,ROBUST:.status.robustness
  • -o custom-columns=… builds a table from the named fields; before the colon is the column heading, after it the path in the object.

Expected:

NAME                                       STATE      NODE   ROBUST
pvc-1be489ab-3891-4c08-b4b4-b3d91dac36d9   attached   vdb1   degraded
pvc-37095780-0d56-4966-a719-884783ff8977   detached          unknown
pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   attached   vdb2   healthy
pvc-e760fa38-f3f3-446d-9edc-6453b63e6b61   attached   vdb4   degraded

What you see: the volume of qdrant-2 (pvc-3709…) is detached. Two others are degraded because one of their Longhorn copies was on vdb3.

Step 4 – bring the node back. On vdb3 you start the agent again:

# on vdb3
sudo systemctl start k3s-agent
# on vdb1
kubectl wait --for=condition=Ready node/vdb3 --timeout=180s

Expected:

node/vdb3 condition met

For us, vdb3 was Ready again 16 seconds after the start. qdrant-2 nevertheless stayed Pending – the taint remains in effect until you remove it.

Step 5 – remove the taint. The minus at the end removes a taint.

# on vdb1
kubectl taint nodes vdb3 node.kubernetes.io/out-of-service=nodeshutdown:NoExecute-

Expected:

node/vdb3 untainted
# on vdb1
kubectl -n qdrant wait --for=condition=Ready pod/qdrant-2 --timeout=300s

Expected:

pod/qdrant-2 condition met

For us, qdrant-2 was ready again 32 seconds after the removal, on vdb3, with its old volume.

Step 6 – is everything back? First Qdrant, then Longhorn. Read the new IP of qdrant-2 from kubectl -n qdrant get pods -o wide and insert it.

# on vdb1
curl -s http://10.42.2.6:6333/cluster -o c2.json
# on vdb1
jq -c '.result | {peers: (.peers|length), role: .raft_info.role, leader: .raft_info.leader, term: .raft_info.term}' c2.json

Expected:

{"peers":3,"role":"Follower","leader":121400021250061,"term":7}
# on vdb1
curl -s http://10.42.2.6:6333/collections/verteilt/cluster -o v2.json
# on vdb1
jq -c '.result | {local: [.local_shards[] | {shard_id, points_count, state}], remote: [.remote_shards[] | {shard_id, state}]}' v2.json

Expected:

{"local":[{"shard_id":0,"points_count":4089,"state":"Active"},{"shard_id":1,"points_count":4702,"state":"Active"}],"remote":[{"shard_id":0,"state":"Active"},{"shard_id":1,"state":"Active"},{"shard_id":2,"state":"Active"},{"shard_id":2,"state":"Active"}]}

What you see: three peers, one leader, the Raft term has risen to 7 – there were elections while vdb3 was gone. All copies are Active. Nothing was written during that time, so there was nothing to catch up on.

A minute later, Longhorn too:

# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io -o custom-columns=NAME:.metadata.name,STATE:.status.state,NODE:.status.currentNodeID,ROBUST:.status.robustness

Expected:

NAME                                       STATE      NODE   ROBUST
pvc-1be489ab-3891-4c08-b4b4-b3d91dac36d9   attached   vdb1   healthy
pvc-37095780-0d56-4966-a719-884783ff8977   attached   vdb3   healthy
pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   attached   vdb2   healthy
pvc-e760fa38-f3f3-446d-9edc-6453b63e6b61   attached   vdb4   healthy

Remember: out-of-service is a signature: “The node is off.” It releases pod and volume – you must have planned a spare slot beforehand.

Save your progress? Sign up for free

Diagnosis task: The change that never finishes

A colleague wants to switch a Deployment from anti-affinity to topology spread. She changes the file and runs kubectl apply. Afterwards she sees:

NAME                           READY   STATUS    RESTARTS   AGE   IP           NODE     NOMINATED NODE   READINESS GATES
platzhalter-76bd956cd8-24kp8   1/1     Running   0          58s   10.42.1.23   vdb2     <none>           <none>
platzhalter-76bd956cd8-kgfnw   1/1     Running   0          58s   10.42.3.14   vdb4     <none>           <none>
platzhalter-76bd956cd8-qh5kn   1/1     Running   0          58s   10.42.2.13   vdb3     <none>           <none>
platzhalter-776f8cbbd6-nnvqh   0/1     Pending   0          27s   <none>       <none>   <none>           <none>
platzhalter-776f8cbbd6-rcxbg   0/1     Pending   0          27s   <none>       <none>   <none>           <none>

The new pods (776f8cbbd6) no longer have any anti-affinity at all. Why are they still waiting?

Find the cause before you read on.

Solution, step by step.

  1. Read the events of a new pod: kubectl get events --field-selector involvedObject.name=platzhalter-776f8cbbd6-nnvqh
  2. The message reads:
0/4 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 3 node(s) didn't satisfy existing pods anti-affinity rules. preemption: 0/4 nodes are available: 1 Preemption is not helpful for scheduling, 3 No preemption victims found for incoming pod.
  1. The difference from Drill 1 lies in one word: existing pods anti-affinity rules. It is not the new pod that has the rule, but the old pods. Their anti-affinity forbids any pod with the label app: platzhalter next to them – including the new ones, because the label has stayed the same.
  2. The rolling update waits for new, ready pods before removing old ones. But the new ones may not go next to the old ones. Neither side gives way.

The fix: delete the Deployment once and create it anew (as in Drill 2), or temporarily use the update strategy Recreate. Both mean accepting a short gap. With Qdrant the question comes up less often, because a StatefulSet replaces pods one at a time – first delete the old one, then create the new one.

Remember: anti-affinity works in both directions. If you remove it, you have to wait until the last old pod is gone.

Cleanup and checkpoint

There is nothing to delete: you removed the placeholders in Drill 2, all nodes are unlocked, the taint is gone. The PDB stays.

# on vdb1
kubectl get nodes

Expected: four nodes Ready, none with SchedulingDisabled.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected: three pods Running, one each on vdb2, vdb3 and vdb4.

# on vdb1
kubectl -n qdrant get pdb

Expected: MAX UNAVAILABLE 1, ALLOWED DISRUPTIONS 1.

# on vdb1
helm -n qdrant list

Expected: REVISION 6, STATUS deployed.

Also check with curl and jq as in Drill 6, Step 6: three peers, all copies of verteilt Active; and with the Longhorn query from Step 3: all volumes healthy.

Test yourself

  1. A fourth Qdrant pod stays Pending. Which rule is to blame, and how can you tell?
  2. Why is anti-affinity better than topology spread for Qdrant?
  3. You set a PDB with maxUnavailable: 1. Does it protect against a crashed node?
  4. A node has been NotReady for ten minutes, the Qdrant pod on it shows Terminating. Why doesn’t Kubernetes start it elsewhere?
  5. What is dangerous about kubectl delete pod --force or the taint out-of-service if the node is actually still running?
  6. Three data nodes, three Qdrant pods, anti-affinity. One node fails permanently. What are you missing?

Answers:

  1. The mandatory anti-affinity. The pod’s events say 3 node(s) didn't match pod anti-affinity rules.
  2. Topology spread allows two Qdrant pods on one node when there are more pods than nodes. Then both copies of a shard can end up on the same node – one failure takes out both.
  3. No. A PDB only applies to evictions, that is, planned disruptions such as kubectl drain.
  4. Because Kubernetes does not know whether the old pod is still running. A StatefulSet guarantees at most one pod per identity; it only creates a replacement once the old one is confirmed deleted.
  5. Kubernetes forgets the pod and releases the volume. If the old container keeps running, there are two writers – exactly what the waiting was supposed to prevent.
  6. A fourth matching node as a spare slot. Without it, the new pod stays Pending, even after out-of-service.

Interview note

“A worker with a database replica fails hard. What happens in Kubernetes?” – After just under a minute (51 seconds for us), Kubernetes marks the node as unreachable, and after another 300 seconds it marks the pods for deletion. With a StatefulSet, the pod then stays in Terminating, because the kubelet does not confirm the deletion; a replacement is deliberately not started. The service stays available only via replicas on other nodes. Once the node is definitely off, you confirm this with the taint out-of-service – and then need a free, matching node, otherwise the replacement stays Pending. A PDB does not help here; it only protects against planned drains.

Enterprise note

In production you plan at least one data node more than pods for Qdrant, otherwise neither a drain nor a failure can move a pod. Anti-affinity goes to zones (topology.kubernetes.io/zone), with topology spread across nodes within the zone. Maintenance runs via drain with a PDB, never via kubectl delete; upgrade tools for nodes (such as a system upgrade controller) only respect PDBs if they use evictions. The taint out-of-service is not set automatically by a script, but by a human after a check – or by a fencing mechanism that has demonstrably shut down the node. And the read prober from this chapter belongs in monitoring as a synthetic check (Day 11).

Summary

  • A fourth Qdrant pod stayed Pending: 3 node(s) didn't match pod anti-affinity rules. For us the message only came after about ten minutes; before that there was a PVC intermediate state.
  • Placeholder pods: anti-affinity 3 running + 1 waiting; topology spread 2–1–1 and with seven pods 3–2–2. Switching over via rolling update got stuck on the anti-affinity of the old pods.
  • PDB maxUnavailable: 1 via Helm (revision 6): draining vdb4 cleared out qdrant-1, the pod stayed Pending; a second drain failed because of the PDB. Prober: 563 answers, 0 errors.
  • Pod deleted (normally and forced): ready again after about 20 seconds, 0 errors.
  • Hard failure of vdb3: unreachable after 51 seconds, Terminating after a little over five more minutes, no replacement. Prober over eight minutes: 1747 answers, 0 errors.
  • out-of-service: old pod deleted, volume detached, new pod Pending – no spare node. After starting the agent and removing the taint, everything was back within about a minute.

Commands at a glance

Command Purpose
kubectl -n qdrant get statefulset qdrant -o jsonpath='{.spec.template.spec.affinity}' read the affinity rules
kubectl -n qdrant scale statefulset qdrant --replicas=4 change the number of pods by hand (experiment only)
kubectl -n qdrant get events --field-selector involvedObject.name=<pod> read the reason for Pending
kubectl apply -f platzhalter-verteilen.yaml create placeholders with topology spread
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml switch on the PDB via the chart
kubectl -n qdrant get pdb view allowed disruptions
~/werkbank/bin/python lesen.py <url> <collection> <seconds> measure search during a failure
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data --timeout=120s clear out a node for maintenance
kubectl uncordon <node> lift the lock
kubectl -n qdrant delete pod <pod> --grace-period=0 --force delete a pod from the API immediately (caution)
sudo /usr/local/bin/k3s-killall.sh simulate a hard node failure (k3s)
kubectl get node <node> -o jsonpath='{range .spec.taints[*]}…{end}' read taints with timestamps
kubectl taint nodes <node> node.kubernetes.io/out-of-service=nodeshutdown:NoExecute confirm that a node is off
kubectl taint nodes <node> node.kubernetes.io/out-of-service=nodeshutdown:NoExecute- withdraw that confirmation
kubectl -n longhorn-system get volumes.longhorn.io -o custom-columns=… state of the Longhorn volumes

Contents

More