Day 11: Replication and Node Failure
Goal: Run Qdrant on two nodes, give the collection
wissena replica and then let rag2 really fail – measure what search, answer service, writes and management commands experience during that time, and how everything comes back · Duration: approx. 120 min · Prerequisite: Day 10
State before this chapter
# on rag1
kubectl -n rag get pods -o wide --field-selector=status.phase=Running--field-selector=status.phase=Running– only running pods; the finished jobs from Days 6 to 10 stay out.
Expected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-7974d4c4c6-6cnnj 1/1 Running 1 (5m15s ago) 140m 10.42.1.4 rag2
curl 1/1 Running 0 3m35s 10.42.1.7 rag2
embed-66bdc7c6c9-rqqpn 1/1 Running 1 (3h22m ago) 20h 10.42.0.33 rag1
llm-579476976d-6rx9d 1/1 Running 0 36m 10.42.0.50 rag1
pg-1 1/1 Running 1 (5m15s ago) 20h 10.42.1.6 rag2
qdrant-0 1/1 Running 0 20h 10.42.1.5 rag2
Your age, names and RESTARTS will be different. What
matters is the column NODE: embedding service and language
model run on rag1, everything else on rag2. rerank has been
at zero replicas since Day 9 and is therefore missing.
Introduction
Up to yesterday you measured how fast the desk is. Today it is about whether it is there at all. Your lab has two nodes, and on one of them – rag2 – stands the only card cabinet: the only Qdrant pod with the only copy of the 173 cards. If rag2 fails, the answer service no longer finds a single card.
Today you set up a second card cabinet on rag1, give the collection
wissen a replica and then switch rag2 off
for real – not simulated, but with a stopped k3s agent
and terminated containers. A small pod measures every second whether
search and answer service still respond.
Today you learn:
- to run Qdrant with Helm in distributed mode on two nodes and to separate the pods with anti-affinity,
- why
replication_factor: 2alone does not create a replica and how you create one withreplicate_shard, - what happens in the first 50 seconds of a node failure before Kubernetes notices it,
- why reading continues but the first write hangs for 36 seconds – and why a new collection is not possible at all (Raft majority with two peers),
- why the answer service is gone for six minutes while the Qdrant pod on rag2 never moves,
- how rag2 comes back and the replica catches up on the missed changes,
- why
topologySpreadConstraintscan still place two pods on the same node, - that your measuring tool itself can slow down the desk.
Background
The picture for today: the second card cabinet in the annex
The library has two buildings: the main building (rag1) with the classification system (embedding service) and the person at the desk (language model), and the annex (rag2). This morning the annex holds the only card cabinet and – without anyone having planned it – the information desk itself as well.
Today you put a second card cabinet into the main building and have all cards copied (the replica). Then the power fails in the annex. You observe four things:
- The signpost in the foyer (the service) keeps sending visitors into the dark annex for almost a minute. Only when the caretaker (the node controller) puts up the notice “annex closed” does it point only to the main building.
- Reading continues – the cabinet in the main building has all the cards.
- Changing gets difficult. Whoever puts a stamp on a card wants it in both cabinets. And changes to the inventory – setting up a new cabinet – are decided by the house council (Raft) by majority. With two members, one of whom is missing, there is no majority.
- The cabinet is bolted down. The desk can move to the main building after a waiting period. The card cabinet in the annex cannot – its floor (the local-path volume) belongs to that building.
On top of that there is a patrol with a stopwatch
(the pod wache, the watch) that requests a card every
second and asks a question at the desk. At the end of the day you will
see that it does not come for free either.
The terms
| Term | Meaning | in the picture |
|---|---|---|
| distributed mode | several Qdrant processes form a cluster and know each other via port 6335 | two buildings, one catalogue |
| Peer | a Qdrant process in the cluster, with a long number as
peer_id |
a building |
| Shard | a part of a collection; wissen has exactly one |
a drawer full of cards |
| Replica | another copy of a shard on another peer | second copy in the other building |
replication_factor |
desired number of copies per shard | “two copies of every drawer” |
| Raft, leader, majority | procedure by which the peers agree on changes to the inventory; a change only counts once the majority has agreed | house council that decides by majority |
| Anti-affinity | rule “not on the same node as pod X” | two cabinets never in the same building |
NotReady |
the node no longer reports to the control plane | notice “annex closed” |
Taint unreachable:NoExecute |
mark on the node; when it expires, Kubernetes deletes the pods there | house rules: clear out after 5 minutes |
| local-path volume | folder on exactly one node | bolted-down cabinet |
| Endpoint | a pod address behind a service, only if the pod is
Ready |
arrow on the signpost |
Remember: A replica protects the cards, not the desk. Whatever stands in only one building fails with that building – this applies to every service, not just the database.
Drill 1: Who stands where
Where you are: on rag1.
What you have afterwards: a list of the pods that would fail with rag2, the helper pod
curlon rag1 and a look at the Qdrant cluster with a single peer.
Step 1 – the folder for today.
# on rag1
mkdir -p ~/kurs/11# on rag1
cd ~/kurs/11Step 2 – what runs on rag2. A field filter on the node name shows exactly the pods that rag2 carries.
# on rag1
kubectl -n rag get pods -o wide --field-selector=spec.nodeName=rag2--field-selector=spec.nodeName=rag2– only pods that are scheduled on rag2.
Expected (excerpt – the running pods, cut off on the right; the finished jobs are in between):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-7974d4c4c6-6cnnj 1/1 Running 1 (5m15s ago) 140m 10.42.1.4 rag2
curl 1/1 Running 0 3m35s 10.42.1.7 rag2
pg-1 1/1 Running 1 (5m15s ago) 20h 10.42.1.6 rag2
qdrant-0 1/1 Running 1 (5m15s ago) 20h 10.42.1.5 rag2
What you see: Four running pods on rag2 – the card
cabinet qdrant-0, PostgreSQL pg-1, the answer
service and your helper pod. The scheduler put them there because rag1
was full with the models. That was never a decision, but today it
becomes important.
Step 3 – bring the tool to safety. You send all
requests to Qdrant with the helper pod curl. If it stands
on rag2, you lose it exactly when you need it. In the author’s trial run
it was at Failed after the failure and did not start again
– it was created with --restart=Never. You create it again
on rag1.
# on rag1
kubectl -n rag delete pod curlExpected (after about 30 seconds):
pod "curl" deleted from rag namespace
Deleting takes 30 seconds because sleep ignores the
signal SIGTERM – Kubernetes waits out the grace period and
then ends the pod hard. You saw the same with the answer service on Day
9.
# on rag1
kubectl run -n rag curl --image=curlimages/curl:8.17.0 --restart=Never \
--overrides='{"spec":{"nodeSelector":{"kubernetes.io/hostname":"rag1"}}}' \
--command -- sleep infinityEverything as on Day 6, only the nodeSelector now says
rag1.
# on rag1
kubectl -n rag wait --for=condition=Ready pod/curl --timeout=120s# on rag1
kubectl -n rag get pod curl -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
curl 1/1 Running 0 1s 10.42.0.56 rag1
Step 4 – the Qdrant cluster from the inside. Qdrant
has been running in distributed mode since Day 4 – the chart sets
cluster.enabled: true –, just with a single peer. The page
/cluster shows whom Qdrant knows.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/cluster > cluster.jsonexec curl -- curl -s …– runcurlin the helper pod,> cluster.json– the response ends up in a file on rag1.
# on rag1
jq '.result | {peer_id, peers, raft_info}' cluster.json{peer_id, peers, raft_info}– only these three fields from the result.
Expected:
{
"peer_id": 3100333476874010,
"peers": {
"3100333476874010": {
"uri": "http://qdrant-0.qdrant-headless:6335/"
}
},
"raft_info": {
"term": 3,
"commit": 30,
"pending_operations": 0,
"leader": 3100333476874010,
"role": "Leader",
"is_voter": true
}
}
| Field | Value | Meaning |
|---|---|---|
peer_id |
3100333476874010 | the number of this Qdrant process; a different number for you |
peers |
one entry | the cluster consists only of qdrant-0, reachable via
port 6335 |
raft_info.role |
Leader |
whoever is alone is leader and always has the majority |
commit |
30 | this many inventory changes (creating collections, indexes …) the house council has decided |
Step 5 – where the cards lie. Each collection has its own cluster page.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/wissen/cluster \
> wissen-cluster.json# on rag1
jq .result wissen-cluster.jsonExpected:
{
"peer_id": 3100333476874010,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 173,
"state": "Active"
}
],
"remote_shards": [],
"shard_transfers": []
}
What you see: One shard (shard_id: 0)
with all 173 cards, local on qdrant-0, no copy anywhere
else (remote_shards: []). This is the drawer that gets a
second copy today.
Remember: Before you talk about failures, check what stands where. A scheduler distributes by free space, not by resilience.
Save your progress? Sign up for free
Drill 2: The second card cabinet
Where you are: on rag1, in
~/kurs/11.What you have afterwards: two Qdrant pods,
qdrant-0on rag2 andqdrant-1on rag1, as a cluster with two peers.
Step 1 – get the values from Day 4.
# on rag1
cp ~/kurs/04/qdrant-werte.yaml .Step 2 – two replicas, never on the same node.
# on rag1
nano qdrant-werte.yamlreplicaCount: 2
persistence:
size: 2Gi
storageClassName: local-path
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
memory: 1Gi
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app.kubernetes.io/name: qdrant
topologyKey: kubernetes.io/hostname| Setting | Value | Meaning |
|---|---|---|
replicaCount |
2 |
the StatefulSet gets a second pod qdrant-1 with its own
volume |
podAntiAffinity |
requiredDuringScheduling… |
hard rule: a Qdrant pod must not run where one is already running |
labelSelector |
app.kubernetes.io/name: qdrant |
“a Qdrant pod” means: a pod with this label |
topologyKey |
kubernetes.io/hostname |
“where” means: the same node |
Without the rule the scheduler could also put qdrant-1
on rag2 – then both cabinets would stand in the same building. The
template for this block is commented out in the chart’s default values
(qdrant-standard-werte.yaml from Day 4, section
affinity).
Step 3 – update the chart.
# on rag1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n rag -f qdrant-werte.yamlhelm upgrade– roll out the existing installationqdrantagain with new values,--version 1.20.3– the same chart version as on Day 4, otherwise you change two things at once.
Expected (excerpt):
Release "qdrant" has been upgraded. Happy Helming!
NAME: qdrant
LAST DEPLOYED: Wed Dec 2 16:57:50 2026
NAMESPACE: rag
STATUS: deployed
REVISION: 2
DESCRIPTION: Upgrade complete
# on rag1
kubectl -n rag rollout status statefulset/qdrant --timeout=400sExpected:
Waiting for 1 pods to be ready...
Waiting for partitioned roll out to finish: 1 out of 2 new pods have been updated...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
partitioned roll out complete: 2 new pods have been updated...
In the lab after 34 seconds. qdrant-0 restarts once in
the process because its pod description (the affinity) has changed – for
a few seconds the search is gone. In operation, plan something like this
into a maintenance window.
Step 4 – where the cabinets stand.
# on rag1
kubectl -n rag get pods -l app.kubernetes.io/name=qdrant -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Running 0 14s 10.42.1.9 rag2
qdrant-1 1/1 Running 0 35s 10.42.0.58 rag1
# on rag1
kubectl -n rag get pvcExpected (excerpt, cut off on the right):
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS
qdrant-storage-qdrant-0 Bound pvc-48a95998-cdb1-468d-afba-542c27954fce 2Gi RWO local-path
qdrant-storage-qdrant-1 Bound pvc-48e012f0-5976-478f-b3e8-96e3558766e1 2Gi RWO local-path
What you see: qdrant-1 runs on rag1 and
has its own, new volume. The local-path volume is created on the node on
which the pod first starts – from now on it belongs to rag1, just as the
one of qdrant-0 belongs to rag2.
Step 5 – the cluster with two peers. This time you
ask qdrant-1 specifically. The name
qdrant-1.qdrant-headless always points to exactly this pod
via the headless service – unlike qdrant.rag, which reaches
sometimes the one, sometimes the other.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/cluster \
> cluster.json# on rag1
jq '.result | {peer_id, peers, raft_info}' cluster.jsonExpected:
{
"peer_id": 1806199031829577,
"peers": {
"3100333476874010": {
"uri": "http://qdrant-0.qdrant-headless:6335/"
},
"1806199031829577": {
"uri": "http://qdrant-1.qdrant-headless:6335/"
}
},
"raft_info": {
"term": 5,
"commit": 34,
"pending_operations": 0,
"leader": 1806199031829577,
"role": "Leader",
"is_voter": true
}
}
What you see: Two peers. qdrant-1
registered with qdrant-0 via --bootstrap at
startup (that is what the chart’s start script says). In the lab
qdrant-1 became leader: when
qdrant-0 restarted because of the new affinity,
qdrant-1 won the election (term rose from 3 to
5). For you the leader may also be qdrant-0 – remember
which one it is, this plays a role in Drill 6.
Remember: A second Qdrant process is started quickly. But all that gives you is an empty second cabinet in the main building – not a single card in it yet.
Save your progress? Sign up for free
Drill 3: The second copy
Where you are: on rag1, in
~/kurs/11.What you have afterwards: the collection
wissenwith one complete copy on each of the two peers.
Step 1 – what qdrant-1 has of
wissen.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected:
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": []
}
What you see: local_shards: [] –
qdrant-1 has nothing. It only knows that shard 0 lies on
the other peer. A search that arrives at qdrant-1 is passed
on to qdrant-0.
Step 2 – enter the wish: two copies.
# on rag1
nano rf2.json{"params": {"replication_factor": 2}}# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X PATCH http://qdrant.rag:6333/collections/wissen \
-H 'Content-Type: application/json' -d @- < rf2.json-X PATCH …/collections/wissen– change settings of an existing collection,-d @- < rf2.json– send the content of the file from rag1 via standard input (Day 8).
Expected:
{"result":true,"status":"ok","time":0.052325866}
Step 3 – did that achieve anything?
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected: exactly the same output as in Step 1 –
local_shards: [].
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/wissen > info.json# on rag1
jq .result.config.params info.jsonExpected:
{
"vectors": {
"size": 1024,
"distance": "Cosine"
},
"shard_number": 1,
"replication_factor": 2,
"write_consistency_factor": 1,
"on_disk_payload": true
}
What you see: The setting is at 2, but there is
still only one copy. replication_factor applies to shards
that are distributed anew. For a collection that
already has data, you have to trigger the copying yourself. Also
remember write_consistency_factor: 1: a write request
counts as successful as soon as one copy has accepted
it. This becomes important in Drill 6.
Step 4 – trigger the copying. The command
replicate_shard needs three pieces of information: which
shard, from which peer, to which peer. You read the peer numbers from
cluster.json in Drill 2: qdrant-0 is the peer
with the URI qdrant-0.qdrant-headless.
# on rag1
nano replizieren.json{
"replicate_shard": {
"shard_id": 0,
"from_peer_id": 3100333476874010,
"to_peer_id": 1806199031829577
}
}Insert your two numbers: from_peer_id =
peer of qdrant-0, to_peer_id = peer of
qdrant-1.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://qdrant.rag:6333/collections/wissen/cluster \
-H 'Content-Type: application/json' -d @- < replizieren.jsonExpected:
{"result":true,"status":"ok","time":0.106103674}
Step 5 – watch the copying. Immediately afterwards:
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected (if you are quick):
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 0,
"state": "Recovery"
}
],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": [
{
"shard_id": 0,
"from": 3100333476874010,
"to": 1806199031829577,
"sync": true,
"method": "snapshot",
"comment": "restoring (0.02s)"
}
]
}
| Field | Value | Meaning |
|---|---|---|
local_shards[0].state |
Recovery |
the copy is being created, it does not answer any search yet |
points_count |
0 | no card has arrived yet |
shard_transfers[0].method |
snapshot |
qdrant-0 takes a snapshot of the shard and sends
it |
sync |
true |
changes during the transfer are sent along |
Step 6 – a quarter of a minute later.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected:
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 173,
"state": "Active"
}
],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": []
}
What you see: 173 cards, Active, no
transfer any more. Now each peer has its own complete copy –
local_shards on the one is remote_shards on
the other.
# on rag1
kubectl -n rag logs qdrant-0 | grep -i transferExpected (excerpt):
2026-12-02T16:58:49.680380Z INFO collection::shards::transfer::transfer_tasks_pool: Transfer of shard wissen:0 -> 1806199031829577 finished
Started at 16:58:48, finished at 16:58:49.68 – under two seconds for 173 cards.
Step 7 – not every collection has a second copy now.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections/handbuch/cluster \
> handbuch.json# on rag1
jq .result handbuch.jsonExpected:
{
"peer_id": 3100333476874010,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 4,
"state": "Active"
}
],
"remote_shards": [],
"shard_transfers": []
}
What you see: The four cards from Day 4 in
handbuch still lie only on qdrant-0.
Replication is a property of the collection, not of the
cluster. What that means in a failure you will see in Drill 6.
Remember:
replication_factoris a wish,replicate_shardis the deed. Always check a replica on the page/collections/<name>/clusterof both peers.
Save your progress? Sign up for free
Drill 4: The watch
Where you are: on rag1, in
~/kurs/11.What you have afterwards: a pod on rag1 that sends a search to Qdrant and a question to the answer service every second and logs status code and duration.
Why a pod. While rag2 fails, you do not want to type
commands by hand and miss the interesting seconds. The watch runs in the
cluster like any user, via the service names qdrant.rag and
antwort.rag, and it stands on rag1 – the
node that stays up.
Step 1 – the watch.
# on rag1
nano wache.yamlapiVersion: v1
kind: Pod
metadata:
name: wache
namespace: rag
spec:
nodeSelector:
kubernetes.io/hostname: rag1
containers:
- name: wache
image: curlimages/curl:8.17.0
command: ["sh", "-c"]
args:
- |
while true; do
s=$(curl -s -o /dev/null -m 2 -w '%{http_code} %{time_total}' \
-H 'Content-Type: application/json' -d "$SUCHE" \
http://qdrant.rag:6333/collections/wissen/points/query)
a=$(curl -s -o /dev/null -m 2 -w '%{http_code} %{time_total}' \
-H 'Content-Type: application/json' -d "$FRAGE" \
http://antwort.rag/frage)
echo "$(date +%T) suche $s antwort $a"
sleep 1
done
env:
- name: SUCHE
value: '{"query": "d4d25b67-bc51-83dc-af11-e456c6fe226d", "limit": 3}'
- name: FRAGE
value: '{"frage": "Wie bekomme ich einen neuen Laptop?"}'
resources:
requests:
cpu: 10m
memory: 16Mi
limits:
memory: 32MiYou do not type the loop in lines 15 to 24 and do not run it yourself – it is the program of the pod, just like the Python code of the answer service.
| Lines | Setting | Meaning |
|---|---|---|
| 7–8 | nodeSelector rag1 |
the watch stands in the main building |
| 16–18 | search | Qdrant is to deliver the three cards most similar to the
print card from Day 6 – a real vector search via the
service qdrant.rag |
| 26–27 | SUCHE |
the query is the ID of a point; Qdrant takes its vector
as the search vector |
| 19–21 | question | a question to the answer service |
| 28–29 | FRAGE |
the laptop question from Day 9: its best score (0.452) is below
MINDEST_SCORE 0.46, so after embedding and search the
service immediately answers “Dazu steht nichts im Handbuch.” (nothing
about this in the handbook) – without asking the language model |
| 16, 19 | -m 2 |
give up after 2 seconds |
| 16, 19 | -w '%{http_code} %{time_total}' |
print status code and duration, -o /dev/null discards
the content |
| 22 | echo |
one line per round: time, search, answer service |
Status code 000 means for curl: no HTTP
response came at all – no connection or time ran out.
Step 2 – start.
# on rag1
kubectl apply -f wache.yamlExpected:
pod/wache created
# on rag1
kubectl -n rag wait --for=condition=Ready pod/wache --timeout=120sStep 3 – the first lines. Wait a few seconds, then:
# on rag1
kubectl -n rag logs wache --tail=5Expected:
16:58:53 suche 200 0.022375 antwort 200 0.731751
16:58:54 suche 200 0.010432 antwort 200 0.268263
16:58:56 suche 200 0.014966 antwort 200 0.430289
16:58:57 suche 200 0.006711 antwort 200 0.278056
16:58:59 suche 200 0.012097 antwort 200 0.751808
What you see: The search takes around 10
milliseconds, the answer service (embedding + search + threshold) 0.3 to
0.8 seconds. With sleep 1 a round takes a good second. This
is the baseline for the failure – and the watch’s time
(UTC) is your timeline from now on.
Remember: Whoever wants to measure a failure needs a clock that stands outside the failing part, and a baseline from before.
Save your progress? Sign up for free
Drill 5: Power failure in the annex
Where you are: one terminal on rag2, one terminal on rag1 in
~/kurs/11.What you have afterwards: a real failure of rag2 and the time Kubernetes needs to notice it.
How a failure becomes real. A node fails when its kubelet no longer reports and its pods no longer respond. You achieve both on rag2 with two commands. First a look at why the first one alone is not enough:
Step 1 – the agent’s unit.
# on rag2
systemctl cat k3s-agentExpected (excerpt – look for the line with
KillMode):
KillMode=process
What you see: KillMode=process means:
systemctl stop only ends the k3s process itself. The
containers deliberately keep running so that an update of k3s does not
interrupt the applications. For a real failure you then end them with
the script k3s-killall.sh, which comes with the k3s
installation.
Step 2 – note the time.
# on rag2
date +%TExpected:
16:59:57
Step 3 – stop the agent.
# on rag2
sudo systemctl stop k3s-agentNo output. From now on rag2 no longer reports to rag1.
Step 4 – end all containers.
# on rag2
sudo /usr/local/bin/k3s-killall.shExpected (excerpt – the first lines, a good 70 in total):
+ [ -s /etc/systemd/system/k3s-agent.service ]
+ basename /etc/systemd/system/k3s-agent.service
+ systemctl stop k3s-agent.service
+ [ -x /etc/init.d/k3s* ]
+ killtree 381593 381602 381756 385894
The script ends all container processes, unmounts their volumes and removes the network interfaces of the pods. The data on the volumes is preserved. In the lab it was finished at 16:59:59.
Step 5 – what rag1 knows after a few seconds.
# on rag1
kubectl get nodesExpected (6 seconds after the stop):
NAME STATUS ROLES AGE VERSION
rag1 Ready control-plane 28h v1.37.2+k3s1
rag2 Ready <none> 28h v1.37.2+k3s1
What you see: Nothing. For Kubernetes, rag2 is still
Ready.
Step 6 – what the watch experiences.
# on rag1
kubectl -n rag logs wache --tail=12Expected:
16:59:49 suche 200 0.013359 antwort 200 0.347055
16:59:51 suche 200 0.006657 antwort 200 0.328583
16:59:52 suche 200 0.005551 antwort 200 0.280595
16:59:53 suche 200 0.006925 antwort 200 0.175615
16:59:55 suche 200 0.006049 antwort 200 0.521018
16:59:56 suche 200 0.004676 antwort 200 0.491572
16:59:58 suche 200 0.006991 antwort 200 0.214890
16:59:59 suche 200 0.009005 antwort 000 0.004333
17:00:02 suche 200 0.004785 antwort 000 2.002674
17:00:05 suche 200 0.006015 antwort 000 2.002308
17:00:08 suche 200 0.009372 antwort 000 2.002183
17:00:13 suche 000 2.002314 antwort 000 2.002475
What you see:
| Time | Column | Value | Meaning |
|---|---|---|---|
| 16:59:59 | antwort | 000 0.004 |
refused immediately – the process had just been ended |
| from 17:00:02 | antwort | 000 2.00 |
no response within 2 seconds: the service points to the answer pod on rag2, and nobody responds there any more |
| 17:00:13 | suche | 000 2.00 |
a search landed at qdrant-0 on rag2 |
| otherwise | suche | 200 |
the other searches landed at qdrant-1 and came back
with all cards |
The answer service is completely gone – there is
only the one pod, and it stands on rag2. The search has gaps: the
service qdrant distributes every new connection randomly to
its endpoints, and qdrant-0 is still on the list. In the
lab, two of fourteen searches ran into the timeout until 17:00:42.
Step 7 – wait until Kubernetes notices. A node that
does not report gets the state Unknown in its condition
Ready. kubectl wait returns exactly then.
# on rag1
kubectl wait --for=condition=Ready=Unknown node/rag2 --timeout=180s--for=condition=Ready=Unknown– wait until the conditionReadyhas the valueUnknown,node/rag2– the node, not a pod.
Expected (in the lab at 17:00:44):
node/rag2 condition met
What you see: From the stop (16:59:58) to here,
47 seconds passed. In a second run later in the day it
was 52 seconds. That is how long a kubelet may stay silent before the
control plane gives up on it
(node-monitor-grace-period).
# on rag1
kubectl get nodesExpected:
NAME STATUS ROLES AGE VERSION
rag1 Ready control-plane 28h v1.37.2+k3s1
rag2 NotReady <none> 28h v1.37.2+k3s1
Step 8 – what get pods claims now.
# on rag1
kubectl -n rag get pods -o wide -l app.kubernetes.io/name=qdrantExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Running 0 2m32s 10.42.1.9 rag2
qdrant-1 1/1 Running 0 2m53s 10.42.0.58 rag1
What you see: qdrant-0 is still at
1/1 Running – although its process has been ended for a
minute. The column shows the last report of the kubelet on rag2, and
that no longer comes. The truth is in the pod’s
conditions:
# on rag1
kubectl -n rag get pod qdrant-0 \
-o jsonpath='{range .status.conditions[*]}{.type}={.status} {end}'-o jsonpath='{range …}…{end}'– printType=Valuefor each condition.
Expected:
PodReadyToStartContainers=True Initialized=True Ready=False ContainersReady=True PodScheduled=True
What you see: Ready=False – the control
plane itself set the pod to “not ready” when rag2 became
NotReady. Exactly this condition decides whether a pod is
an endpoint of a service. In the lab (polling every three seconds),
qdrant-0 and the answer pod disappeared from the endpoints
in the same poll in which rag2 was NotReady for the first
time – from then on no search landed on rag2 any more.
Step 9 – the watch after the notice.
# on rag1
kubectl -n rag logs wache --tail=6Expected:
17:00:30 suche 200 0.010933 antwort 000 2.002668
17:00:33 suche 200 0.008117 antwort 000 2.002449
17:00:36 suche 200 0.020551 antwort 000 2.002322
17:00:39 suche 200 0.016661 antwort 000 2.001962
17:00:42 suche 200 0.010799 antwort 000 2.002982
17:00:46 suche 200 0.010289 antwort 000 2.003349
What you see: The search is gap-free again –
everything runs via qdrant-1 and its copy. The answer
service stays gone: the service antwort now has
no endpoint at all.
Remember: The first roughly 50 seconds of a failure are the most dangerous: Kubernetes does not know anything yet, and the service keeps sending requests to the dead pod. A replica helps afterwards – before that, only a short timeout at the caller helps.
Save your progress? Sign up for free
Drill 6: Writing without a majority
Where you are: on rag1, in
~/kurs/11. rag2 is still off.What you have afterwards: Qdrant’s responses to a write request, an inventory change and a search in a collection without a replica – while a peer is missing.
Step 1 – the house council.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/cluster \
> cluster-aus.json# on rag1
jq '.result | {raft_info, message_send_failures}' cluster-aus.jsonExpected (the long error line cut off on the right):
{
"raft_info": {
"term": 5,
"commit": 38,
"pending_operations": 0,
"leader": 1806199031829577,
"role": "Leader",
"is_voter": true
},
"message_send_failures": {
"http://qdrant-0.qdrant-headless:6335/": {
"count": 27,
"latest_error": "Error in closure supplied to transport channel pool: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-0.qdrant-headless:6335/, error: transport error\"",
"latest_error_timestamp": "2026-12-02T17:00:45.579018257Z"
}
}
}
What you see: In the lab qdrant-1 is
still Leader – it already was before the failure. But 27
messages to qdrant-0 have failed. A leader alone is one of
two votes, so no majority. If the leader was on rag2
before, you see "role": "Candidate" and
"leader": 0 here: qdrant-1 tries to get
elected and does not get the second vote – that is how it went in the
author’s trial run.
Step 2 – a stamp on a card. You put an additional
payload entry geprueft (checked) on the print card. This is
an ordinary write request, just like the ones the ingestion makes.
# on rag1
nano stempel.json{
"payload": {"geprueft": "2026-12-02"},
"points": ["d4d25b67-bc51-83dc-af11-e456c6fe226d"]
}# on rag1
kubectl -n rag exec -i curl -- \
curl -s -w '\n%{http_code} %{time_total}\n' -X POST \
'http://qdrant.rag:6333/collections/wissen/points/payload?wait=true' \
-H 'Content-Type: application/json' -d @- < stempel.json| Setting | Value | Meaning |
|---|---|---|
…/points/payload |
POST |
set payload entries, existing ones stay |
?wait=true |
only respond once the change has been applied | |
-w '\n%{http_code} %{time_total}\n' |
after the response, status code and duration on a line of their own | |
'…' |
the URL in single quotes, because otherwise ? can be
interpreted by the shell |
Expected (the error message is one long line):
{"status":{"error":"Service internal error: Some replica of shard 0 failed to apply operation and deactivation timed out after 30s. Consistency of this update is not guaranteed. Please retry. Failed peer: 3100333476874010, error: Service internal error: Tonic status error: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-0.qdrant-headless:6335/, error: transport error\""},"time":36.442713979}
500 36.450822
What you see: After 36 seconds a
500. The message explains the sequence:
qdrant-1writes the stamp into its copy and wants to pass it on toqdrant-0– the connection fails.- It wants to have
qdrant-0marked as “dead” (deactivation) so that nobody reads from this outdated copy any more. That is an inventory change, and it needs the majority in the house council. - The majority does not come about; after 30 seconds it gives up: “Consistency of this update is not guaranteed. Please retry.”
Step 3 – once more.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -w '\n%{http_code} %{time_total}\n' -X POST \
'http://qdrant.rag:6333/collections/wissen/points/payload?wait=true' \
-H 'Content-Type: application/json' -d @- < stempel.jsonExpected:
{"result":{"operation_id":28,"status":"completed"},"status":"ok","time":0.005125115}
200 0.010683
What you see: The repetition goes through in 10
milliseconds. Because of write_consistency_factor: 1 one
copy is enough, and Qdrant apparently does not retry the dead copy with
every request – in the trial run, too, only the first request per shard
ran into the 30 seconds. The stamp is now only in the
cabinet in the main building. Whether the annex gets it later, you check
in Drill 8.
For the ingestion this means: a job that aborts at the first error
fails during a failure at exactly this first request.
backoffLimit: 1 from Day 6 gives it a second attempt.
Step 4 – a new cabinet. A new collection is a pure inventory change.
# on rag1
nano schrank.json{"vectors": {"size": 1024, "distance": "Cosine"}}# on rag1
kubectl -n rag exec -i curl -- \
curl -s -w '\n%{http_code} %{time_total}\n' -X PUT \
http://qdrant.rag:6333/collections/probe \
-H 'Content-Type: application/json' -d @- < schrank.jsonExpected:
{"status":{"error":"Service internal error: Waiting for consensus operation commit failed. Timeout set at: 10 seconds"},"time":10.009877666}
500 10.017575
What you see: After 10 seconds a 500.
The leader has written the proposal “create collection
probe” into its log, but without a second vote it cannot
decide it (commit). The same applies to indexes, aliases,
deleting collections and replicate_shard: everything that
changes the inventory stands still. Keep the name
probe in mind.
Step 5 – the collection without a second copy.
# on rag1
nano handbuch-suche.json{"query": 1, "limit": 2}"query": 1 searches with the vector of card 1 (print
service) from Day 4.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -w '\n%{http_code} %{time_total}\n' -X POST \
http://qdrant.rag:6333/collections/handbuch/points/query \
-H 'Content-Type: application/json' -d @- < handbuch-suche.jsonExpected:
{"status":{"error":"Service internal error: 1 of 1 read operations failed:\n Service internal error: Tonic status error: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-0.qdrant-headless:6335/, error: transport error\""},"time":6.501243871}
500 6.507149
What you see:
1 of 1 read operations failed – there is exactly one copy,
and it lies in the dark building. After 6.5 seconds
qdrant-1 gives up. The search in wissen ran in
10 milliseconds at the same time.
Step 6 – what qdrant-1 writes into the
log.
# on rag1
kubectl -n rag logs qdrant-1 --since=3m | grep -E 'WARN|ERROR'--since=3m– only the last three minutes,grep -E 'WARN|ERROR'– only warnings and errors.
Expected (excerpt, cut off on the right – in the lab
there were also two more Failed to send message):
… WARN storage::content_manager::consensus_manager: Failed to send message to http://qdrant-0.qdrant-headless:6335/ …
… WARN collection::shards::replica_set::update: Failed to update shard wissen:0 on peer 3100333476874010, …
… ERROR qdrant::actix::helpers: Error processing request: Service internal error: Some replica of shard 0 failed …
… WARN storage::content_manager::consensus_manager: Timed out after 10s waiting for consensus to apply CollectionMeta(CreateCollection(…
… ERROR qdrant::actix::helpers: Error processing request: Service internal error: Waiting for consensus operation commit failed. …
… ERROR qdrant::actix::helpers: Error processing request: Service internal error: 1 of 1 read operations failed:
Remember: With two peers, a failure is harmless for the cards, but not for the house council: reading works, writing stalls once, inventory changes do not work at all. Whoever also wants management to be resilient needs three peers – then two of three remain, and that is a majority.
Save your progress? Sign up for free
Drill 7: Five minutes of house rules
Where you are: on rag1, in
~/kurs/11. rag2 is still off.What you have afterwards: the answer service back – on rag1 – and the explanation why
qdrant-0andpg-1do not come along.
Step 1 – the mark on the node.
# on rag1
kubectl describe node rag2 | grep -A2 Taintsgrep -A2 Taints– the line withTaintsand the two following ones.
Expected:
Taints: node.kubernetes.io/unreachable:NoExecute
node.kubernetes.io/unreachable:NoSchedule
Unschedulable: false
What you see: When rag2 became
NotReady, the control plane set two taints:
NoSchedule – no new pods there – and NoExecute
– existing pods are deleted as soon as their toleration expires.
Step 2 – how long the pods tolerate.
# on rag1
kubectl -n rag get pod -l app=antwort -o jsonpath='{.items[0].spec.tolerations}'Expected:
[{"effect":"NoExecute","key":"node.kubernetes.io/not-ready","operator":"Exists","tolerationSeconds":300},{"effect":"NoExecute","key":"node.kubernetes.io/unreachable","operator":"Exists","tolerationSeconds":300}]
What you see: tolerationSeconds: 300.
Kubernetes sets this toleration automatically on every pod unless you
specify something else. Only five minutes after
NotReady does the control plane delete the pods on rag2 –
in the lab around 17:05:44.
Step 3 – five minutes later. Wait until about six minutes after the stop, then:
# on rag1
kubectl -n rag get pods -o wide -l app=antwortExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-7974d4c4c6-6cnnj 1/1 Terminating 1 (14m ago) 149m 10.42.1.4 rag2
antwort-7974d4c4c6-jfglz 1/1 Running 0 18s 10.42.0.61 rag1
What you see: The old pod is at
Terminating – it is marked for deletion, but nobody on rag2
can confirm that. The deployment immediately started a new pod on rag1.
A deployment is allowed to do that: it only promises “one pod of this
kind runs somewhere”.
# on rag1
kubectl -n rag logs wache --tail=12Expected (excerpt – the lines around the switch):
17:05:52 suche 200 0.010127 antwort 000 2.003039
17:05:55 suche 200 0.013479 antwort 000 2.002608
17:05:58 suche 200 0.009232 antwort 000 2.004837
17:05:59 suche 200 0.006178 antwort 200 0.619395
17:06:01 suche 200 0.013800 antwort 200 0.678551
17:06:02 suche 200 0.006526 antwort 200 0.142326
What you see: The answer service was gone
from 16:59:59 to 17:05:58 – six minutes: almost a
minute until NotReady, five minutes of toleration, a few
seconds of start. The cards were there the whole time.
Step 4 – and the cabinets?
# on rag1
kubectl -n rag get pods -o wide -l app.kubernetes.io/name=qdrantExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Terminating 0 7m52s 10.42.1.9 rag2
qdrant-1 1/1 Running 0 8m13s 10.42.0.58 rag1
# on rag1
kubectl -n rag get statefulset qdrantExpected:
NAME READY AGE
qdrant 1/2 20h
# on rag1
kubectl -n rag get pods -o wide pg-1Expected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
pg-1 1/1 Terminating 1 (14m ago) 20h 10.42.1.6 rag2
What you see: qdrant-0 and
pg-1 are also marked for deletion, but no
new pod has been created. Two reasons:
- A StatefulSet promises “at most one pod with the
name
qdrant-0”. As long as the old pod has not been confirmed deleted, it could still be running and writing to its volume. So the StatefulSet waits. (CloudNativePG behaves just as cautiously withpg-1.) - Even if it did not wait: the volume of
qdrant-0is a folder on rag2. A newqdrant-0could only start on rag2. What happens when someone gives it a push is shown in the diagnosis task.
PostgreSQL has one instance in this course –
pg-1 is gone during the failure. The answer service does
not need it; to make PostgreSQL resilient, the cluster would need
instances: 2 (see Enterprise note).
# on rag1
kubectl -n rag get events \
--field-selector reason=TaintManagerEviction,involvedObject.name=qdrant-0Expected (excerpt):
LAST SEEN TYPE REASON OBJECT MESSAGE
34s Normal TaintManagerEviction pod/qdrant-0 Marking for deletion Pod rag/qdrant-0
Remember: Kubernetes moves a Deployment after five minutes, a StatefulSet with a local volume never. For the database, the replica is the protection against failure, not the scheduler.
Save your progress? Sign up for free
Drill 8: The annex comes back
Where you are: one terminal on rag2, one terminal on rag1 in
~/kurs/11.What you have afterwards: rag2 back in the cluster,
qdrant-0with the stamp added afterwards – and a collection that should not actually exist.
Step 1 – start the agent.
# on rag2
sudo systemctl start k3s-agentNo output. The command returns when k3s has started (in the lab after 10 seconds).
# on rag2
systemctl is-active k3s-agentExpected:
active
Step 2 – wait until rag2 is back.
# on rag1
kubectl wait --for=condition=Ready node/rag2 --timeout=300sExpected:
node/rag2 condition met
In the lab rag2 was Ready again nine seconds after the
start.
Step 3 – the cabinets.
# on rag1
kubectl -n rag rollout status statefulset/qdrant --timeout=300sExpected:
Waiting for 1 pods to be ready...
partitioned roll out complete: 2 new pods have been updated...
# on rag1
kubectl -n rag get pods -o wide -l app.kubernetes.io/name=qdrantExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Running 0 15s 10.42.1.2 rag2
qdrant-1 1/1 Running 0 9m8s 10.42.0.58 rag1
What you see: qdrant-0 is a
new pod (age 15 seconds): the kubelet on rag2 confirmed
the deletion of the old one, and the StatefulSet immediately started a
new one – again on rag2, with the old volume and therefore with the same
peer_id.
# on rag1
kubectl -n rag get pods -o wide -l app=antwortExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-7974d4c4c6-jfglz 1/1 Running 0 74s 10.42.0.61 rag1
The old answer pod has disappeared, the new one stays on rag1 – a
deployment does not move back by itself. pg-1 is also
running again on rag2.
Step 4 – does the annex have the stamp? First, what
qdrant-1 did after the return:
# on rag1
kubectl -n rag logs qdrant-1 --since=5m | grep -i transferExpected (excerpt, cut off on the right):
2026-12-02T17:06:51.525866Z WARN …: Rejected consensus entry index=45 operation=CollectionMeta(TransferShard("wissen", Start(ShardTransfer { shard_id: 0, to_shard_id: None, from: 1806199031829577, to: 3100333476874010, sync: true, method: Some(WalDelta), …
2026-12-02T17:06:51.673221Z INFO collection::shards::transfer::transfer_tasks_pool: Transfer of shard wissen:0 -> 3100333476874010 finished
What you see: As soon as qdrant-0 was
back, qdrant-1 transferred the shard to it – with the
method WalDelta: not all cards, but only
the entries from its write-ahead log (WAL) that qdrant-0
missed. The warning Rejected … already involved in transfer
only means that the transfer was already running. At 17:06:51.67 it was
finished – seven seconds after rag2 was Ready again.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-0.qdrant-headless:6333/collections/wissen/points/d4d25b67-bc51-83dc-af11-e456c6fe226d \
> punkt-0.json…/points/<id>– fetch a point by its ID, directly fromqdrant-0.
# on rag1
jq .result.payload.geprueft punkt-0.jsonExpected:
"2026-12-02"
What you see: The stamp that was set only on rag1 during the failure is now also in the cabinet on rag2. The catching up happened by itself.
Step 5 – the house council.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/cluster \
> cluster.json# on rag1
jq '.result | {raft_info, message_send_failures}' cluster.jsonExpected:
{
"raft_info": {
"term": 5,
"commit": 47,
"pending_operations": 0,
"leader": 1806199031829577,
"role": "Leader",
"is_voter": true
},
"message_send_failures": {}
}
What you see: No more errors, and
commit has risen from 38 to 47 – the house council has made
up for nine decisions. Which ones, the next step shows.
Step 6 – the cabinet that came after all.
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant.rag:6333/collections > sammlungen.json# on rag1
jq -c '.result.collections' sammlungen.json-c– print compactly on one line.
Expected:
[{"name":"handbuch"},{"name":"probe"},{"name":"wissen"},{"name":"wissen-2000"},{"name":"wissen-500"},{"name":"wissen-ohne-kontext"},{"name":"wissen-ohne-ueberlappung"}]
What you see: The collection
probe exists – although Qdrant responded
with 500 in Drill 6. The leader qdrant-1 had
kept the proposal in its Raft log. When qdrant-0 came back,
the majority was there again, and the proposal was decided after the
fact. Strictly speaking, the error message said “waiting for the
decision timed out”, not “rejected”.
In the author’s trial run the leader was on rag2. There
qdrant-1 discarded the proposal immediately
(proposal dropped), and the collection was never created.
Whether a timeout still takes effect later therefore depends on who is
leader at the moment – you cannot rely on it in either direction.
Step 7 – clean up. You do not need the collection
probe.
# on rag1
kubectl -n rag exec curl -- \
curl -s -X DELETE http://qdrant.rag:6333/collections/probeExpected:
{"result":true,"status":"ok","time":0.09570315}
Step 8 – and handbuch?
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -w '\n%{http_code} %{time_total}\n' -X POST \
http://qdrant.rag:6333/collections/handbuch/points/query \
-H 'Content-Type: application/json' -d @- < handbuch-suche.jsonExpected:
{"result":{"points":[{"id":4,"version":1,"score":0.5442346},{"id":3,"version":1,"score":0.50144875}]},"status":"ok","time":0.00942066}
200 0.013675
With qdrant-0, the only copy of handbuch is
back too.
# on rag1
kubectl -n rag logs wache --tail=5Expected:
17:06:59 suche 200 0.006060 antwort 200 0.183958
17:07:00 suche 200 0.020441 antwort 200 0.239531
17:07:02 suche 200 0.009320 antwort 200 0.408735
17:07:03 suche 200 0.009070 antwort 200 0.474371
17:07:05 suche 200 0.006382 antwort 200 0.420859
What you see: During the return there was not a
single error line in the lab – qdrant-0 only became an
endpoint once its readiness probe (/readyz) had passed.
Remember: A
500after a timeout means “unknown”, not “did not happen”. After a failure, check what is really in the inventory – and clean up what nobody wants any more.
Save your progress? Sign up for free
Drill 9: The desk in both buildings
Where you are: on rag1, in
~/kurs/11.What you have afterwards: two answer services, one per node, and the measurement of what a second failure of rag2 still does now.
What this is about. Drill 7 showed: the cards survived the failure, the desk did not – for six minutes. The solution is the same as for Qdrant: two copies, in two buildings.
Step 1 – the manifest from Day 10.
# on rag1
cp ~/kurs/10/antwort.yaml antwort.yamlStep 2 – two replicas, evenly distributed.
# on rag1
nano antwort.yamlChange line 7 and insert the block
topologySpreadConstraints under spec: of the
pod template (lines 16–22):
apiVersion: apps/v1
kind: Deployment
metadata:
name: antwort
namespace: rag
spec:
replicas: 2
selector:
matchLabels:
app: antwort
template:
metadata:
labels:
app: antwort
spec:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: antwort
containers:
- name: antwort
image: python:3.14.10-slim-trixie
command: ["python", "/code/antwort.py"]
env:
- name: SAMMLUNG
value: wissen
- name: KARTEN
value: "3"
- name: LLM_TIMEOUT
value: "60"
- name: MINDEST_SCORE
value: "0.46"
- name: RERANK_URL
value: ""
- name: PLAETZE
value: "2"
ports:
- containerPort: 8080
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
memory: 128Mi
readinessProbe:
httpGet:
path: /health
port: 8080
volumeMounts:
- name: code
mountPath: /code
volumes:
- name: code
configMap:
name: antwort-code
---
apiVersion: v1
kind: Service
metadata:
name: antwort
namespace: rag
spec:
selector:
app: antwort
ports:
- port: 80
targetPort: 8080| Setting | Value | Meaning |
|---|---|---|
replicas |
2 |
two answer services |
maxSkew |
1 |
the number of pods per node may differ by at most 1 |
topologyKey |
kubernetes.io/hostname |
“distribute” means: across nodes |
whenUnsatisfiable |
DoNotSchedule |
rather not start than break the rule |
labelSelector |
app: antwort |
pods with this label are counted |
Step 3 – apply.
# on rag1
kubectl apply -f antwort.yamlExpected:
deployment.apps/antwort configured
service/antwort unchanged
# on rag1
kubectl -n rag rollout status deployment/antwort --timeout=180sExpected (last line):
deployment "antwort" successfully rolled out
# on rag1
kubectl -n rag get pods -l app=antwort -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-6dcb6ddb67-46tkc 1/1 Running 0 24s 10.42.1.5 rag2
antwort-6dcb6ddb67-5jhvl 1/1 Running 0 12s 10.42.1.6 rag2
antwort-7974d4c4c6-jfglz 1/1 Terminating 0 2m44s 10.42.0.61 rag1
What you see: Both new pods stand
on rag2 – despite the spread rule. The reason lies in the
labelSelector: all pods with
app: antwort are counted, including the old one on rag1,
which only goes at the end of the rollout. For the first new pod the
scheduler saw “rag1: 1, rag2: 0” and took rag2. For the second “rag1: 1,
rag2: 1” and took rag2 again. Then the old one was deleted – and the
rule is never checked again after scheduling.
Step 4 – count only your own generation. Every pod
of a deployment carries the label pod-template-hash, which
is different for every version of the template. With
matchLabelKeys the scheduler only counts pods with the
same value – that is, only the new generation.
# on rag1
nano antwort.yamlapiVersion: apps/v1
kind: Deployment
metadata:
name: antwort
namespace: rag
spec:
replicas: 2
selector:
matchLabels:
app: antwort
template:
metadata:
labels:
app: antwort
spec:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: antwort
matchLabelKeys:
- pod-template-hash
containers:
- name: antwort
image: python:3.14.10-slim-trixie
command: ["python", "/code/antwort.py"]
env:
- name: SAMMLUNG
value: wissen
- name: KARTEN
value: "3"
- name: LLM_TIMEOUT
value: "60"
- name: MINDEST_SCORE
value: "0.46"
- name: RERANK_URL
value: ""
- name: PLAETZE
value: "2"
ports:
- containerPort: 8080
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
memory: 128Mi
readinessProbe:
httpGet:
path: /health
port: 8080
volumeMounts:
- name: code
mountPath: /code
volumes:
- name: code
configMap:
name: antwort-code
---
apiVersion: v1
kind: Service
metadata:
name: antwort
namespace: rag
spec:
selector:
app: antwort
ports:
- port: 80
targetPort: 8080# on rag1
kubectl apply -f antwort.yaml# on rag1
kubectl -n rag rollout status deployment/antwort --timeout=180s# on rag1
kubectl -n rag get pods -l app=antwort -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-6dcb6ddb67-46tkc 1/1 Terminating 0 53s 10.42.1.5 rag2
antwort-b4c788ff5-2lxqs 1/1 Running 0 16s 10.42.1.7 rag2
antwort-b4c788ff5-8t6bm 1/1 Running 0 4s 10.42.0.62 rag1
What you see: One new pod per node. The old one on rag2 disappears shortly.
Step 5 – rag2 fails once more. The same commands as in Drill 5:
# on rag2
date +%TExpected:
17:09:08
# on rag2
sudo systemctl stop k3s-agent# on rag2
sudo /usr/local/bin/k3s-killall.sh# on rag1
kubectl wait --for=condition=Ready=Unknown node/rag2 --timeout=180sExpected (in the lab at 17:10:00, 52 seconds after the stop):
node/rag2 condition met
Step 6 – what the watch experiences this time.
# on rag1
kubectl -n rag logs wache --tail=25Expected (excerpt – from the stop until shortly
after NotReady):
17:09:08 suche 200 0.011140 antwort 200 0.375041
17:09:10 suche 200 0.006937 antwort 200 0.581604
17:09:13 suche 200 0.008650 antwort 000 2.003482
17:09:16 suche 000 2.002813 antwort 200 0.190522
17:09:19 suche 200 0.006628 antwort 000 2.001509
17:09:24 suche 000 2.003218 antwort 000 2.002814
17:09:29 suche 000 2.003037 antwort 000 2.002791
17:09:33 suche 200 0.007748 antwort 000 2.003036
17:09:34 suche 200 0.005928 antwort 503 0.007340
17:09:35 suche 200 0.006608 antwort 503 0.006350
17:09:38 suche 200 0.007356 antwort 000 2.001540
17:09:41 suche 000 2.002068 antwort 503 0.007289
17:09:44 suche 200 0.005816 antwort 000 2.003384
17:09:45 suche 200 0.007330 antwort 503 0.006223
17:09:50 suche 000 2.002348 antwort 000 2.003066
17:09:55 suche 000 2.002146 antwort 000 2.002707
17:09:58 suche 200 0.010199 antwort 000 2.003095
17:09:59 suche 200 0.006667 antwort 503 0.005308
17:10:03 suche 000 2.002638 antwort 200 0.867592
17:10:04 suche 200 0.006752 antwort 200 0.411377
17:10:06 suche 200 0.006729 antwort 200 0.302998
17:10:07 suche 200 0.008491 antwort 200 0.382245
What you see:
| Section | Answer service | Meaning |
|---|---|---|
| until 17:09:10 | 200 |
baseline |
| 17:09:13 – 17:09:59 | 10 × 000, 5 × 503, 1 ×
200 |
rag2 is dead but still an endpoint |
| from 17:10:04 | 200 |
NotReady, only the pod on rag1 is an endpoint |
The gap has shrunk from six minutes to 52 seconds.
But in these 52 seconds almost every question went wrong – more than the
half you would expect with two endpoints. And what is
503?
Step 7 – why 503? 503 is
the rejection from Day 10: “too many questions at the same time”. But
the watch only asks one question per second. The log of the answer
service on rag1 explains it. Insert your pod name from Step 4:
# on rag1
kubectl -n rag logs antwort-b4c788ff5-8t6bmExpected (excerpt – look for the lines
abgewiesen (rejected) and the end of the error
message):
keine Karte bester 0.452 Wie bekomme ich einen neuen Laptop?
abgewiesen, 2 Plätze belegt Wie bekomme ich einen neuen Laptop?
abgewiesen, 2 Plätze belegt Wie bekomme ich einen neuen Laptop?
----------------------------------------
Exception occurred during processing of request from ('10.42.0.59', 38102)
Traceback (most recent call last):
File "/usr/local/lib/python3.14/urllib/request.py", line 1333, in do_open
…
File "/usr/local/lib/python3.14/socket.py", line 859, in create_connection
sock.connect(sa)
~~~~~~~~~~~~^^^^
TimeoutError: timed out
What you see: The answer service on rag1 asks Qdrant
via the service qdrant.rag – and in the same minute that
sometimes sent it to qdrant-0 on rag2. This connection
hangs until the timeout of 30 seconds from anfrage() and
occupies one of the two seats for that long. Two
hanging searches, and the desk rejects everyone. The failure of a node
thus hits the answer service twice: directly (its pod
on rag2) and via the search.
Step 8 – rag2 back.
# on rag2
sudo systemctl start k3s-agent# on rag1
kubectl wait --for=condition=Ready node/rag2 --timeout=300s# on rag1
kubectl -n rag rollout status deployment/antwort --timeout=180sExpected (last line):
deployment "antwort" successfully rolled out
Remember: Two copies in two buildings turn minutes into seconds – but only if they really stand in two buildings. Check the distribution after the rollout with
-o wide, and keep timeouts to neighbouring services short, otherwise a dead neighbour blocks your seats.
Save your progress? Sign up for free
Drill 10: The watch goes home
Where you are: on rag1, in
~/kurs/11.What you have afterwards: the proof that a measurement is load too – and a tidied-up lab.
What this is about. The watch asks a question every good second, for which the embedding service computes a vector. That looks harmless. What it costs, you measure with a real question to the person at the desk.
Step 1 – the embedding service with the watch running. The watch has been running since Drill 4.
# on rag1
kubectl -n rag top pod -l app=embedExpected:
NAME CPU(cores) MEMORY(bytes)
embed-66bdc7c6c9-rqqpn 2498m 1536Mi
Step 2 – a real question. The Secret question from Day 9:
# on rag1
cp ~/kurs/09/f02.json .# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H "Content-Type: application/json" -d @- < f02.json > antwort.json# on rag1
jq . antwort.jsonExpected (excerpt – the end; the answer itself is correct: “[1] Ein Secret darf maximal 1 MiB in Größe betragen.” – a Secret may be at most 1 MiB in size):
"sekunden": {
"suche": 0.34,
"gesamt": 48.09
}
}
# on rag1
kubectl -n rag logs deployment/llm --tail=40 | grep 'eval time'Expected:
slot print_timing: id 0 | task 47 | prompt eval time = 4321.91 ms / 1 tokens ( 4321.91 ms per token, 0.23 tokens per second)
slot print_timing: id 0 | task 47 | eval time = 43388.15 ms / 17 tokens ( 2711.76 ms per token, 0.37 tokens per second)
What you see: 48 seconds for an answer with 17
tokens – the model wrote 0.37 tokens per second. On Day
10 it was 5 to 14. In a first attempt in the lab, the same question even
ran into the timeout of 60 seconds
({"fehler": "keine Antwort in 60.0 s"}). The reason is the
same as with the two model replicas on Day 10: embedding service and
language model each start as many threads as rag1 has cores, and crowd
each other out. Every question from the watch wakes up the embedding
service, and it takes the cores away from the person at the desk.
Step 3 – withdraw the watch.
# on rag1
kubectl -n rag delete pod wacheExpected (after about 30 seconds, for the same
reason as with curl):
pod "wache" deleted from rag namespace
Step 4 – the same question without the watch. Wait half a minute, then:
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://antwort.rag/frage \
-H "Content-Type: application/json" -d @- < f02.json > antwort.json# on rag1
jq . antwort.jsonExpected:
{
"antwort": "[1] Ein Secret darf maximal 1 MiB in Größe betragen.",
"quellen": [
{
"nr": 1,
"quelle": "k8s-secret.md",
"abschnitt": "Size limit",
"score": 0.733
},
{
"nr": 2,
"quelle": "k8s-secret.md",
"abschnitt": "Secrets",
"score": 0.608
},
{
"nr": 3,
"quelle": "k8s-secret.md",
"abschnitt": "Secrets",
"score": 0.582
}
],
"sekunden": {
"suche": 0.42,
"gesamt": 2.63
}
}
# on rag1
kubectl -n rag logs deployment/llm --tail=40 | grep 'eval time'Expected:
slot print_timing: id 0 | task 65 | prompt eval time = 574.38 ms / 1 tokens ( 574.38 ms per token, 1.74 tokens per second)
slot print_timing: id 0 | task 65 | eval time = 1582.57 ms / 17 tokens ( 98.91 ms per token, 10.11 tokens per second)
What you see: 2.63 instead of 48 seconds, 10.1
instead of 0.37 tokens per second. In both runs the prompt was already
in the cache (1 tokens), so it was only about writing. The
watch made the desk almost twenty times slower.
Remember: A probe that goes through the expensive path is load itself. For a failure test it is right – in continuous operation you ask less often and preferably the cheap part (Qdrant directly,
/health).
If it does not work
| Symptom | Cause | Fix |
|---|---|---|
qdrant-1 stays Pending |
the anti-affinity forbids the node on which qdrant-0
already runs, and the other has no room |
kubectl -n rag describe pod qdrant-1, section
Events |
after replication_factor: 2,
local_shards: [] is shown |
the factor only applies to newly distributed shards (Drill 3) | replicate_shard with both peer numbers |
local_shards shows Recovery and
points_count: 0 |
the copy is being transferred | wait a few seconds, then query again |
the helper pod curl is at Failed after the
failure |
it ran on rag2 and was created with
--restart=Never |
delete it and create it again on rag1 (Drill 1) |
kubectl get pods shows pods on the dead node as
1/1 Running |
the column shows the last report of the kubelet | read the condition Ready with -o jsonpath
(Drill 5) |
first write request during the failure: 500 after 36 s,
“Please retry” |
the dead copy cannot be deregistered without a Raft majority | repeat; the second goes through (Drill 6) |
PUT /collections/… during the failure: 500
after 10 s |
no majority for inventory changes | after the failure check whether the collection was created after all (Drill 8) |
| both answer pods land on the same node | the spread rule counts the old pods too | matchLabelKeys: [pod-template-hash] (Drill 9) |
503 from the answer service although hardly anyone
asks |
hanging connections to a dead Qdrant pod occupy the seats | wait until NotReady; permanently: shorter timeouts to
Qdrant |
| answers of the language model become extremely slow while the watch is running | embedding service and model share the cores of rag1 | delete the watch (Drill 10) |
Save your progress? Sign up for free
Diagnosis task
The situation: rag2 has failed. A colleague sees
qdrant-0 on a dead node and wants to help: “I’ll delete the
pod hard, then the StatefulSet will restart it on rag1.” He deletes it
with --force. But the new qdrant-0 does not
start. Why – and what is the right reaction?
Recreate the situation: rag2 off as in Drill 5, Steps 3 and 4, then on rag1:
# on rag1
kubectl wait --for=condition=Ready=Unknown node/rag2 --timeout=180s# on rag1
kubectl -n rag delete pod qdrant-0 --force --grace-period=0--force --grace-period=0– remove the object from the API immediately, without waiting for the kubelet’s confirmation.
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-0" force deleted from rag namespace
The warning means it: if rag2 were only cut off from the network and
qdrant-0 kept running there, there would now be two pods
with the same name and the same peer. This is exactly what the waiting
of the StatefulSet from Drill 7 protects against.
Try it yourself first, then read on.
Solution.
Step 1 – the state.
# on rag1
kubectl -n rag get pods -l app.kubernetes.io/name=qdrant -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 0/1 Pending 0 6s <none> <none>
qdrant-1 1/1 Running 0 12m 10.42.0.58 rag1
Step 2 – why the scheduler finds no place.
# on rag1
kubectl -n rag describe pod qdrant-0Expected (excerpt – the section Events
at the end):
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 6s default-scheduler 0/2 nodes are available: 1 node(s) didn't match PersistentVolume's node affinity, 1 node(s) had untolerated taint(s). preemption: 0/2 nodes are available: 2 Preemption is not helpful for scheduling.
What you see: Two nodes, two reasons: rag2 has a
taint that the pod does not tolerate
(unreachable:NoSchedule), and rag1 does not match the “node
affinity” of the volume.
Step 3 – which volume.
# on rag1
kubectl -n rag get pvc qdrant-storage-qdrant-0Expected (cut off on the right):
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS
qdrant-storage-qdrant-0 Bound pvc-48a95998-cdb1-468d-afba-542c27954fce 2Gi RWO local-path
Insert the name from the column VOLUME:
# on rag1
kubectl describe pv pvc-48a95998-cdb1-468d-afba-542c27954fceExpected (excerpt):
Annotations: local.path.provisioner/selected-node: rag2
pv.kubernetes.io/provisioned-by: rancher.io/local-path
…
Node Affinity:
Required Terms:
Term 0: kubernetes.io/hostname in [rag2]
…
Source:
Type: LocalVolume (a persistent volume backed by local storage on a node)
Path: /var/lib/rancher/k3s/storage/pvc-48a95998-cdb1-468d-afba-542c27954fce_rag_qdrant-storage-qdrant-0
The cause: The volume is a folder on rag2
(Path), and the node affinity of the PersistentVolume only
allows rag2. A pod that wants this volume cannot start anywhere else.
The hard deletion gained nothing – it only overrode the protection of
the StatefulSet.
Step 4 – the right reaction. Do nothing to
qdrant-0. The search runs via qdrant-1 and its
copy. When rag2 comes back, qdrant-0 starts there by
itself:
# on rag2
sudo systemctl start k3s-agent# on rag1
kubectl -n rag wait --for=condition=Ready pod/qdrant-0 --timeout=300sExpected (in the lab 10 seconds after rag2 was
Ready):
pod/qdrant-0 condition met
# on rag1
kubectl -n rag get pods -l app.kubernetes.io/name=qdrant -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Running 0 50s 10.42.1.4 rag2
qdrant-1 1/1 Running 0 12m 10.42.0.58 rag1
What you take away from it: --force is
meant for the case where you know for sure that the
node stays dead – and even then it only helps if the volume can go
somewhere else. With local volumes, the protection against failure is
the replica in Qdrant. If a node does not come back at all, you rebuild
the peer (empty volume, new copy with replicate_shard) –
that is manual work and belongs in a runbook, not in a spontaneous
reaction.
Challenge
The collection handbuch was not readable during the
failure (Drill 6, Step 5). Give it a second copy on
qdrant-1 and prove that both peers have an active copy –
without switching off rag2 for it.
The author’s solution. The same two steps as in
Drill 3, for handbuch. You already have the file
rf2.json.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X PATCH http://qdrant.rag:6333/collections/handbuch \
-H 'Content-Type: application/json' -d @- < rf2.jsonExpected:
{"result":true,"status":"ok","time":0.075595557}
# on rag1
cp replizieren.json replizieren-handbuch.jsonThe peers are the same as for wissen –
handbuch also lay only on qdrant-0 (Drill 3,
Step 7). So the file stays the same; the collection is in the URL.
# on rag1
kubectl -n rag exec -i curl -- \
curl -s -X POST http://qdrant.rag:6333/collections/handbuch/cluster \
-H 'Content-Type: application/json' -d @- < replizieren-handbuch.jsonExpected:
{"result":true,"status":"ok","time":0.294749472}
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/handbuch/cluster \
> handbuch-1.json# on rag1
jq .result handbuch-1.jsonExpected (three seconds later):
{
"peer_id": 1806199031829577,
"shard_count": 1,
"local_shards": [
{
"shard_id": 0,
"points_count": 4,
"state": "Active"
}
],
"remote_shards": [
{
"shard_id": 0,
"peer_id": 3100333476874010,
"state": "Active"
}
],
"shard_transfers": []
}
Locally four cards Active on qdrant-1,
remotely an active copy on qdrant-0 – the proof without a
failure.
Save your progress? Sign up for free
Checkpoint
# on rag1
kubectl get nodesExpected:
NAME STATUS ROLES AGE VERSION
rag1 Ready control-plane 28h v1.37.2+k3s1
rag2 Ready <none> 28h v1.37.2+k3s1
# on rag1
kubectl -n rag get pods -o wide -l app.kubernetes.io/name=qdrantExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Running 0 84s 10.42.1.4 rag2
qdrant-1 1/1 Running 0 13m 10.42.0.58 rag1
# on rag1
kubectl -n rag get pods -o wide -l app=antwortExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
antwort-b4c788ff5-2lxqs 1/1 Running 1 (47s ago) 2m42s 10.42.1.2 rag2
antwort-b4c788ff5-8t6bm 1/1 Running 0 2m30s 10.42.0.62 rag1
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-0.qdrant-headless:6333/cluster \
> cluster.json# on rag1
jq '.result | {peers, raft_info, message_send_failures}' cluster.jsonExpected:
{
"peers": {
"1806199031829577": {
"uri": "http://qdrant-1.qdrant-headless:6335/"
},
"3100333476874010": {
"uri": "http://qdrant-0.qdrant-headless:6335/"
}
},
"raft_info": {
"term": 5,
"commit": 52,
"pending_operations": 0,
"leader": 1806199031829577,
"role": "Follower",
"is_voter": true
},
"message_send_failures": {}
}
# on rag1
kubectl -n rag exec curl -- \
curl -s http://qdrant-1.qdrant-headless:6333/collections/wissen/cluster \
> wissen-1.json# on rag1
jq .result wissen-1.jsonExpected: local_shards with
"points_count": 173, "state": "Active" and
remote_shards with "state": "Active" – as in
Drill 3, Step 6.
# on rag1
kubectl -n rag exec curl -- curl -s -i http://antwort.rag/healthExpected:
HTTP/1.0 200 OK
Server: BaseHTTP/0.6 Python/3.14.10
Date: Wed, 02 Dec 2026 17:11:27 GMT
Content-Type: application/json
Content-Length: 16
{"status": "ok"}
# on rag1
kubectl -n rag get pod wacheExpected:
Error from server (NotFound): pods "wache" not found
Two nodes Ready, two Qdrant peers without send errors,
wissen (and with the challenge handbuch)
active on both, two answer services on two nodes, no watch any more.
Test yourself
- You set
replication_factorto 2 on a filled collection. How do you recognise whether there is already a replica, and what else is missing? - rag2 fails. Why does the search return errors in the first roughly 50 seconds despite the replica – and afterwards no longer?
- Why does the first write request during the failure hang for 36 seconds, but the second does not?
- Qdrant responds to “create collection” during the failure with
500. May you conclude from this that the collection does not exist? - Why does the answer service move to rag1 after five minutes, but
qdrant-0never does? - Two answer pods with a spread rule land on the same node after a rollout. What happened?
Answers:
- On
/collections/<name>/clusterof each peer: if the shard is only listed underremote_shardsandlocal_shardsis empty, there is no copy. The factor only applies to newly distributed shards; you trigger the copy withreplicate_shard. - Kubernetes only marks rag2 as
NotReadyafter 47–52 seconds. Until thenqdrant-0is an endpoint of the service, and connections there go nowhere. WithNotReadythe control plane sets the pod toReady=False, it drops out of the endpoints, and all searches go toqdrant-1. - Qdrant wants to deregister the unreachable copy as “dead”. That is
an inventory change and needs the Raft majority – with two peers there
is none without rag2. After 30 seconds it gives up with “Please retry”.
The repetition only writes into the reachable copy; because of
write_consistency_factor: 1that is enough. - No. The error means that waiting for the decision timed out. In the
lab the proposal was in the leader’s log and was decided after rag2
returned –
probewas suddenly there. - A deployment may start a replacement pod anywhere. A StatefulSet waits until the old pod has been confirmed deleted so that two pods never write to the same volume – and the local-path volume lies only on rag2 anyway.
- The spread rule counted the pods of the old version, which were only
deleted at the end of the rollout. With
matchLabelKeys: [pod-template-hash]only the own generation counts.
Interview note
“How do you make a vector database on Kubernetes resilient?” – With
replication in the database, not via the storage: two
or better three Qdrant peers with anti-affinity, collections with
replication_factor ≥ 2 and verified copies per shard. Two
peers protect the data and reading, but not management, because Raft
needs a majority – three peers survive the failure of one node
completely. Testing is done with a real node failure and a probe in the
cluster: in the first roughly 50 seconds the service keeps sending to
the dead pod; after NotReady everything runs via the copy.
The application in front of it also needs several replicas on different
nodes and short connection timeouts, otherwise hanging connections block
its capacity.
Enterprise note
In operation, Qdrant runs with at least three peers in three
availability zones, and write_consistency_factor is chosen
deliberately: 1 keeps writing as long as one copy is alive (as today), 2
rejects writes when a copy is missing, and guarantees consistency in
return. A PodDisruptionBudget (in the chart
podDisruptionBudget.enabled) prevents a maintenance drain
from shutting down both peers at the same time. Instead of local
volumes, many use network-attached storage (Ceph, LINSTOR) – then a pod
can move to another node, but that does not replace database
replication. For PostgreSQL, the counterpart with CloudNativePG is
instances: 2 or more with automatic failover. The five
minutes until eviction can be shortened per pod via custom
tolerations; that helps stateless services, not
StatefulSets with a local volume. And a synthetic probe like the watch
runs in operation from a node of its own and at intervals that do not
noticeably load the system.
Summary
- Qdrant was already running in distributed mode;
replicaCount: 2with anti-affinity puts the second peer on rag1. replication_factor: 2creates no copy –replicate_sharddoes that; under two seconds for 173 cards.- A node failure becomes visible after 47–52 seconds
(
NotReady). Until then requests land at the dead pod. - Reading from
wissencontinued through the failure;handbuchwithout a copy returned500. - The first write request hung for 36 seconds and
ended with
500, the second went through. Inventory changes failed after 10 seconds – and were carried out after the return after all. - The answer service on rag2 was gone for six minutes
(toleration 300 s).
qdrant-0andpg-1never move. - After the return,
qdrant-0caught up on the missed changes viaWalDelta– seven seconds afterReadythe stamp was on rag2 too. - Two answer services need a spread rule with
matchLabelKeys; then the gap shrinks to the 52 seconds untilNotReady, in which hanging searches block the seats (503). - The watch made the desk almost twenty times slower – measuring is load.
Commands at a glance
| Command | What it does | Important options |
|---|---|---|
kubectl -n <ns> get pods -o wide --field-selector=spec.nodeName=<node> |
pods of a node | status.phase=Running as an additional filter |
helm upgrade <release> <chart> --version <v> -n <ns> -f <values> |
roll out an installation again with new values | pin --version |
curl -s http://<pod>.<headless-svc>:6333/cluster |
peers, leader and Raft state of a specific Qdrant peer | – |
curl -s …/collections/<name>/cluster |
local and remote shards of a collection from the point of view of one peer | – |
curl -X PATCH …/collections/<name> -d '{"params":{…}}' |
change settings of a collection | – |
curl -X POST …/collections/<name>/cluster -d '{"replicate_shard":{…}}' |
copy a shard to another peer | shard_id, from_peer_id,
to_peer_id |
curl -X POST '…/points/payload?wait=true' |
set payload entries | wait=true |
systemctl cat <unit> |
show the unit file | – |
sudo systemctl stop k3s-agent ·
sudo /usr/local/bin/k3s-killall.sh |
stop the agent, end all containers | – |
kubectl wait --for=condition=Ready=Unknown node/<node> |
wait until a node counts as failed | --timeout= |
kubectl get pod <name> -o jsonpath='{range .status.conditions[*]}…{end}' |
read the conditions of a pod | – |
kubectl describe node <node> |
taints, conditions, pods of a node | – |
kubectl -n <ns> get events --field-selector reason=…,involvedObject.name=… |
filter events specifically | – |
kubectl -n <ns> delete pod <name> --force --grace-period=0 |
remove the pod object immediately (caution) | – |
kubectl describe pv <name> |
node affinity and path of a volume | – |
topologySpreadConstraints with
matchLabelKeys: [pod-template-hash] |
distribute the pods of one version evenly across nodes | maxSkew, whenUnsatisfiable |