Skip to content
k0s and LINSTOR · Chapter 23 of 27 Day 21: Automatic failover – Grafana, HA Controller and NFS

Day 21: Automatic failover – Grafana, HA Controller and NFS

Goal: You install Grafana with Helm on a volume with two replicas, let its node fail – first without, then with the Piraeus HA Controller – and run a volume that two pods on different nodes write to at the same time (ReadWriteMany over NFS). · Duration: approx. 2 hours · Prerequisite: Day 15 (LINSTOR 1.35.3, CSI v1.13.2), Day 10

State before this chapter

LINSTOR and the CSI driver are at the level of Day 15, and no resource is faulty.

LINSTOR runs 1.35.3 everywhere.

# on k0s-ctrl
linstor --no-utf8 --no-color node list

Expected: four lines, all Online.

# on k0s-ctrl
ssh k0s-w1 dpkg -l linstor-satellite

Expected (excerpt, last line):

hi  linstor-satellite 1.35.3-1     all          DRBD distributed resource management utility

The CSI driver is v1.13.2.

# on k0s-ctrl
kubectl -n piraeus-datastore get deploy linstor-csi-controller \
  -o jsonpath='{.spec.template.spec.containers[?(@.name=="linstor-csi")].image}{"\n"}'

Expected:

quay.io/piraeusdatastore/piraeus-csi:v1.13.2

No resource is faulty.

# on k0s-ctrl
linstor --no-utf8 --no-color resource list --faulty

Expected: an empty table.

If the CSI driver is still at v1.12.0, work through Day 15 up to Drill 4. Why that matters for this chapter, you will see in Drill 6.

Introduction

On Day 10 you learned how to handle a failed node by hand: wait until Kubernetes wants to evict the pod, check that the node is really down, then set the out-of-service taint. That is safe, but slow – and it needs a person who is awake at three in the morning.

Today you switch on two components that Day 7 deliberately switched off: the HA Controller, which takes over exactly this manual work, and the NFS server, which lets several pods on different nodes write to the same volume. Your application is Grafana, installed with Helm, the way you install most applications in practice. You take every measurement twice – without and with automation – so you can see what it really brings.

Today you learn:

  • to install an application with Helm on a LINSTOR volume with two replicas,
  • to measure a node failure without the HA Controller and resolve it with the out-of-service taint,
  • to switch on the HA Controller – and why it first starts on no node at all,
  • to measure the same failure with the HA Controller,
  • to create ReadWriteMany volumes over NFS and why the CSI version matters for that,
  • to measure the failure of the node that carries the NFS export.

Background

The picture of the day: emergency service and dispatch counter

In the shipping company you know the head office (controller), the warehouses (satellites) and the fitters (CSI Node). Today two roles join them:

  • The emergency service (HA Controller) sits in every building. If a warehouse fails while a customer is being served there, it does not wait for someone to check. It sees from the DRBD state that the other replica may take over, sends the customer to the other warehouse and hangs a sign “accept nothing new here” on the door.
  • The dispatch counter (NFS server) hands out the goods of one warehouse to several customers at once. If the warehouse with the counter fails, another warehouse with a replica opens a new counter at the same house number.

The terms

Term Meaning In the picture
HA Controller Piraeus DaemonSet; sees through DRBD that a replica on another node may take over, deletes the hanging pod and releases the volume emergency service
drbd.linbit.com/lost-quorum taint the HA Controller sets on the failed node sign “accept nothing new”
ReadWriteMany (RWX) access mode of a volume: many pods on many nodes may write goods for several customers
NFS server Piraeus DaemonSet; exports an RWX volume via NFS from a node with a replica dispatch counter
linstor-csi-nfs service under which the export is reachable, no matter on which node it currently runs fixed house number

This is the path for an RWX volume: the pods do not write to DRBD themselves but go through the service to the dispatch counter. The lower half shows what happens when the warehouse with the counter fails – you measure that in Drill 7.

ReadWriteMany: the NFS export moves from k0s-w1 to k0s-w2, the writers stay

Remember: The HA Controller does nothing you did not also do by hand on Day 10. It just does it immediately – and for that it needs the quorum from the StorageClass of Day 8.

Drill 1: Grafana with Helm on two replicas

Where you are: on k0s-ctrl.

In this drill:

  • You find the right Helm chart for Grafana.
  • You install Grafana on a volume with two replicas.
  • You check where Grafana runs and where the replicas are.
  • You create a folder that later shows you the data survived.

Step 1 – the directory for today. You put all of today’s files in a folder of their own and change into it.

# on k0s-ctrl
mkdir -p ~/k0s-lab/tag21
# on k0s-ctrl
cd ~/k0s-lab/tag21

Step 2 – find the right chart. A chart is an installation package for Helm. For a long time the Grafana chart lived in the repository grafana/helm-charts. Add both repositories, the old and the new one:

# on k0s-ctrl
helm repo add grafana https://grafana.github.io/helm-charts
# on k0s-ctrl
helm repo add grafana-community https://grafana-community.github.io/helm-charts

Expected:

"grafana-community" has been added to your repositories

Then you reload the list of charts from both repositories:

# on k0s-ctrl
helm repo update

Now you read the description of the old chart:

# on k0s-ctrl
helm show readme grafana/grafana

Expected (excerpt – look for the line with migrated):

**This chart is being migrated to [grafana-community/helm-charts](https://github.com/grafana-community/helm-charts).**

helm show readme shows the description of a chart without installing anything. The old chart is moving; you take the new one. Which versions does it offer?

# on k0s-ctrl
helm search repo grafana-community/grafana --versions

Expected (excerpt, the first lines):

NAME                            CHART VERSION   APP VERSION         DESCRIPTION
grafana-community/grafana       14.7.0          13.3.2              The leading tool for querying and visualizing t...
grafana-community/grafana       14.6.1          13.3.2              The leading tool for querying and visualizing t...

--versions lists all versions. You pin 14.7.0 (Grafana 13.3.2).

Step 3 – the values file. In the values file you tell the chart how to set up Grafana. You create it with nano.

# on k0s-ctrl
nano grafana-werte.yaml
~/k0s-lab/tag21/grafana-werte.yaml new file
adminPassword: labor-grafana-21
deploymentStrategy:
  type: Recreate
persistence:
  enabled: true
  storageClassName: linstor-replicated
  size: 1Gi
service:
  type: NodePort
  nodePort: 32000
Setting Meaning
adminPassword password of the user admin – in plain text for the lab only
deploymentStrategy.type: Recreate stop the old pod first, then start the new one. With RollingUpdate (the default) the new pod waits during an update for a volume the old one still holds
persistence.enabled: true Grafana’s database lives on a PVC instead of inside the container
storageClassName: linstor-replicated the StorageClass from Day 8: two replicas, writecache, quorum
service.type: NodePort, nodePort: 32000 Grafana is reachable on every node at port 32000

You do not set replicas: by default the chart starts one pod.

Step 4 – namespace and installation. First you create a namespace of its own, then you install the chart into it.

# on k0s-ctrl
kubectl create namespace grafana
# on k0s-ctrl
helm install grafana grafana-community/grafana --version 14.7.0 \
  -n grafana -f grafana-werte.yaml
  • helm install grafana – installs a release named grafana.
  • grafana-community/grafana – the chart from the new repository.
  • --version 14.7.0 – exactly this chart version, so that it looks the same for you.
  • -n grafana – into the namespace grafana.
  • -f grafana-werte.yaml – your values from step 3.

Expected (excerpt):

NAME: grafana
NAMESPACE: grafana
STATUS: deployed
REVISION: 1

Now you wait until Grafana runs. rollout status keeps waiting until the pod is ready; --timeout=400s gives up after 400 seconds.

# on k0s-ctrl
kubectl -n grafana rollout status deploy/grafana --timeout=400s

Expected: after almost three minutes (the image is 490 MB)

deployment "grafana" successfully rolled out

Step 5 – where does Grafana run, where are the replicas? First you ask Kubernetes for the pod and the PVC (the claim for a volume).

# on k0s-ctrl
kubectl -n grafana get pods,pvc -o wide

Expected (excerpt):

NAME                           READY   STATUS    RESTARTS   AGE     IP           NODE
pod/grafana-5bd9dcddf8-g4gdf   1/1     Running   0          2m53s   10.244.2.7   k0s-w3

NAME                            STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
persistentvolumeclaim/grafana   Bound    pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200   1Gi        RWO            linstor-replicated

With the name of the volume you ask LINSTOR where the replicas are.

# on k0s-ctrl
linstor --no-utf8 --no-color resource list \
  -r pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200

Use the name of your PV (column VOLUME).

Expected:

| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-ctrl | DRBD,STORAGE            | Unused | Ok    | Diskless | Yes  |
| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-w2   | DRBD,WRITECACHE,STORAGE | Unused | Ok    | UpToDate | Yes  |
| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-w3   | DRBD,WRITECACHE,STORAGE | InUse  | Ok    | UpToDate | Yes  |

What you see: Grafana runs on k0s-w3 and writes there (InUse). The second replica is on k0s-w2, k0s-ctrl is the referee without data (Diskless). For you these may be other nodes – note which one runs Grafana.

Step 6 – leave a trace. Through Grafana’s API you create a folder. After each failure you check whether it is still there. 172.16.0.163 is the address of k0s-w3 in the author’s lab. The addresses of your nodes are in your ~/.ssh/config (Day 0) – put in yours.

# on k0s-ctrl
curl -s -u admin:labor-grafana-21 \
  -H "Content-Type: application/json" \
  -d '{"title":"Failover-Probe"}' \
  http://172.16.0.163:32000/api/folders -o ordner.json
Setting Meaning
-u admin:labor-grafana-21 log in with user and password
-H "Content-Type: application/json" the body is JSON
-d '{"title":"Failover-Probe"}' the new folder
http://172.16.0.163:32000 NodePort on any node – here k0s-w3
-o ordner.json write the answer to the file ordner.json

With jq you read only the two fields uid and title from the answer:

# on k0s-ctrl
jq '{uid, title}' ordner.json

Expected:

{
  "uid": "fg5ziazkldxj4a",
  "title": "Failover-Probe"
}

What you see: The folder Failover-Probe exists. Grafana assigns the uid itself; yours is a different one.

Remember: persistence and storageClassName in the values decide whether a Helm application puts its data on LINSTOR. With an RWO volume, Recreate belongs with it.

Save your progress? Sign up for free

Drill 2: The failure without emergency service

Where you are: on k0s-ctrl.

In this drill:

  • You cut the node with the Grafana pod off the network.
  • You measure how long Kubernetes takes on its own.
  • You find out why the new pod hangs.
  • You bring Grafana back by hand with the out-of-service taint.

You cut the node with the Grafana pod off the network without switching it off: four rules in the packet filter iptables drop everything that reaches or leaves it. Only SSH from k0s-ctrl stays open. To the cluster this looks like a dead node. The commands here are for k0s-w3; if Grafana runs on another node for you, take that one.

Caution: The block lets SSH through only from k0s-ctrl. So log in to k0s-ctrl first and from there with ssh k0s-w3. A session straight from your laptop would drop otherwise.

Step 1 – the safety net: a timer. Before you lock yourself out, you set a timer: after 30 minutes it removes the block by itself.

# on k0s-w3
sudo systemd-run --unit=netz-zurueck --on-active=30min iptables -t raw -F
  • systemd-run --unit=netz-zurueck starts a job named netz-zurueck.
  • --on-active=30min runs it only in 30 minutes.
  • iptables -t raw -F is the job: delete all rules of the table raw, i.e. the block.

Step 2 – the block, rule by rule. iptables checks the rules from top to bottom, and the first matching one decides. So you allow SSH from k0s-ctrl first and only then drop everything else. 172.16.0.117 is the address of k0s-ctrl in the author’s lab – yours is in your ~/.ssh/config (Day 0), put in yours.

Rule 1: incoming SSH from k0s-ctrl may come in.

# on k0s-w3
sudo iptables -t raw -A PREROUTING -s 172.16.0.117 -p tcp --dport 22 -j ACCEPT
Setting Meaning
-t raw the table raw; the kernel checks it before the rules Kubernetes creates
-A PREROUTING append the rule to the chain for incoming packets (-A = append)
-s 172.16.0.117 only packets from this sender address (source)
-p tcp --dport 22 only TCP packets to port 22, where SSH listens
-j ACCEPT let it through; the kernel checks no further rules for this packet

Rule 2: everything else that comes in is dropped. ! -i lo means: all packets that do not come in via lo, the machine’s path to itself. -j DROP drops them silently.

# on k0s-w3
sudo iptables -t raw -A PREROUTING ! -i lo -j DROP

Rule 3: the SSH answers to k0s-ctrl may go out. -A OUTPUT is the chain for packets the node sends itself; -d is the destination address, --sport 22 the sender port of SSH.

# on k0s-w3
sudo iptables -t raw -A OUTPUT -d 172.16.0.117 -p tcp --sport 22 -j ACCEPT

Rule 4: everything else that goes out is dropped. From now on the node is cut off.

# on k0s-w3
sudo iptables -t raw -A OUTPUT ! -o lo -j DROP

Note the time when the last rule takes effect. In the author’s lab it was 18:37:02; yours is a different one.

Step 3 – watch. In a second terminal on k0s-ctrl you watch the pods:

# on k0s-ctrl
kubectl -n grafana get pods -o wide -w

-w (watch) keeps running and prints every change as a new line. Stop it with Ctrl+C.

In the author’s lab this was the timeline. For your run, compare the gaps in the right-hand column, not the times:

Time Event since the cut
18:37:02 k0s-w3 cut off, Grafana is still listed as Running 0 s
18:37:48 node NotReady, taint node.kubernetes.io/unreachable 46 s
18:42:48 TaintManagerEviction: new pod on k0s-w1, old pod Terminating 5 min 46 s
from 18:42:49 new pod hangs in Init:0/1 –

What you see: After 46 seconds Kubernetes marks the node NotReady and sets the taint unreachable – a sign on the node that keeps pods away. By default every pod tolerates this taint for 300 seconds. Only then does Kubernetes evict it: 46 s + 300 s = 5 min 46 s.

Step 4 – why the new pod hangs. The events of the namespace tell you. --sort-by=.lastTimestamp sorts them by time, the newest at the bottom.

# on k0s-ctrl
kubectl -n grafana get events --sort-by=.lastTimestamp

Expected (excerpt – look for the line with FailedAttachVolume):

Warning   FailedAttachVolume       pod/grafana-5bd9dcddf8-4mlj5    Waiting for detach for volume "pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200" Volume is already used by pod(s) grafana-5bd9dcddf8-g4gdf

Your pod and volume names are different. The new pod waits until the volume is detached from the old node. Where Kubernetes believes it is attached is recorded in the VolumeAttachment, the entry for “volume X is attached to node Y”. -o custom-columns shows just three columns of it: PV, node and whether it is attached.

# on k0s-ctrl
kubectl get volumeattachments \
  -o custom-columns=PV:.spec.source.persistentVolumeName,NODE:.spec.nodeName,ATTACHED:.status.attached

Expected:

PV                                         NODE     ATTACHED
pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200   k0s-w3   true

What you see: Kubernetes believes the volume is still attached to k0s-w3. It cannot know whether the node is down or just not answering – and it never gives an RWO volume to two nodes. You know this from Day 10.

Step 5 – the confirmation by hand. You have checked that k0s-w3 no longer writes (it is off the network). Then you set the out-of-service taint. It tells Kubernetes: “This node really is down.” After that Kubernetes may detach the volume.

# on k0s-ctrl
kubectl taint node k0s-w3 \
  node.kubernetes.io/out-of-service=nodeshutdown:NoExecute
  • node.kubernetes.io/out-of-service – the key of the taint Kubernetes provides for this.
  • nodeshutdown – the value; it describes the reason.
  • NoExecute – the effect: pods on the node are evicted, new ones are not scheduled.

Expected:

node/k0s-w3 tainted

Step 6 – wait until Grafana runs. You check whether the new pod starts now.

# on k0s-ctrl
kubectl -n grafana get pods -o wide

Expected (after a few minutes):

NAME                       READY   STATUS    RESTARTS   AGE     IP           NODE
grafana-5bd9dcddf8-4mlj5   1/1     Running   0          6m33s   10.244.1.7   k0s-w1

In the lab Grafana ran at 18:49:21, 2 minutes 41 seconds after the taint. Part of that was downloading the image on k0s-w1, where it was not present yet. In total Grafana was gone for just over 12 minutes.

Step 7 – is the data there? You ask Grafana for its folders. This time via k0s-w1 (172.16.0.184 in the author’s lab), because k0s-w3 is off the network. Take the address of a node that is reachable – put in yours.

# on k0s-ctrl
curl -s -u admin:labor-grafana-21 \
  http://172.16.0.184:32000/api/folders -o ordner-danach.json

jq -c '[.[].title]' takes only the titles from the list and prints them on one line (-c).

# on k0s-ctrl
jq -c '[.[].title]' ordner-danach.json

Expected:

["Failover-Probe"]

What you see: The folder is still there. Grafana read its data from the second replica.

Remember: Without emergency service it takes about six minutes before Kubernetes acts at all – and then the new pod hangs until a person sets the out-of-service taint.

Save your progress? Sign up for free

Drill 3: Bring the node back

Where you are: on k0s-ctrl.

In this drill:

  • You lift the block and remove the taint.
  • You check that both replicas are up to date again.
  • You load the Grafana image onto all workers in advance.
  • You bring Grafana back to k0s-w3 – so the comparison in Drill 5 is fair.

Step 1 – lift the block and stop the timer. On k0s-w3 you delete all rules of the table raw. Then you stop the timer from Drill 2. systemd-run created it as netz-zurueck.timer.

# on k0s-w3
sudo iptables -t raw -F
# on k0s-w3
sudo systemctl stop netz-zurueck.timer

Step 2 – remove the taint. The same command as in Drill 2, step 5 – the - at the end removes the taint again.

# on k0s-ctrl
kubectl taint node k0s-w3 \
  node.kubernetes.io/out-of-service=nodeshutdown:NoExecute-

Expected:

node/k0s-w3 untainted

Step 3 – check the replicas. You ask LINSTOR whether both replicas are up to date again. Use the name of your PV.

# on k0s-ctrl
linstor --no-utf8 --no-color resource list \
  -r pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200

Expected:

| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-ctrl | DRBD,STORAGE            | Unused | Ok    | Diskless | Yes  |
| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-w1   | DRBD,STORAGE            | InUse  | Ok    | Diskless | No   |
| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-w2   | DRBD,WRITECACHE,STORAGE | Unused | Ok    | UpToDate | Yes  |
| pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200 | k0s-w3   | DRBD,WRITECACHE,STORAGE | Unused | Ok    | UpToDate | Yes  |

What you see: Grafana writes on k0s-w1 – without its own replica (Diskless), over the network to the replicas on k0s-w2 and k0s-w3. That works because LINSTOR CSI allows access without a local replica by default.

Step 4 – load the image in advance. So that the next attempt measures only the failover, you pull the Grafana image onto every worker:

# on k0s-w1
sudo k0s ctr -n k8s.io images pull docker.io/grafana/grafana:13.3.2-distroless

The same on k0s-w2 and k0s-w3. k0s ctr is the containerd tool that ships with k0s; -n k8s.io is the namespace in which Kubernetes looks for its images.

Step 5 – Grafana back on a node with a replica. For a fair comparison Grafana should run on k0s-w3 again. Briefly block the other two workers for new pods. kubectl cordon means: no new pod may start here; running pods stay. If Grafana first ran on another node for you, block the other two workers.

# on k0s-ctrl
kubectl cordon k0s-w1 k0s-w2

Now you delete the Grafana pod. -l selects it by its label. The Deployment starts a new one right away – and it only fits on k0s-w3.

# on k0s-ctrl
kubectl -n grafana delete pod -l app.kubernetes.io/name=grafana

Then you release the two workers again:

# on k0s-ctrl
kubectl uncordon k0s-w1 k0s-w2

Finally you check where Grafana runs:

# on k0s-ctrl
kubectl -n grafana get pods -o wide

Expected:

NAME                       READY   STATUS    RESTARTS   AGE   IP           NODE
grafana-5bd9dcddf8-728j2   1/1     Running   0          35s   10.244.2.8   k0s-w3

What you see: Grafana runs on k0s-w3 again, the node with its own replica.

Remember: After every failure the same order as on Day 10: block off, taint off, check the replicas. A forgotten out-of-service taint keeps the node empty for good.

Save your progress? Sign up for free

Drill 4: Switch on the emergency service

Where you are: on k0s-ctrl, in ~/k0s-lab/tag21.

In this drill:

  • You switch on the HA Controller in the values file.
  • You see that at first it starts on no node at all.
  • You exempt it from the inherited nodeSelector.
  • You read in the log what it does.

Step 1 – round 1: just switch it on. Copy the values file from Day 15 (werte-4.yaml with CSI v1.13.2) and change one line:

# on k0s-ctrl
cp ~/k0s-lab/tag15/werte-4.yaml werte-ha.yaml
# on k0s-ctrl
nano werte-ha.yaml

In nano you change only the section highAvailabilityController:

~/k0s-lab/tag21/werte-ha.yaml (excerpt) changes in green
  highAvailabilityController:
    enabled: true

Step 2 – apply. With helm upgrade you apply the changed values. --version 1.3.2 pins the chart version, -n names the namespace, -f the values file.

# on k0s-ctrl
helm upgrade linstor-cluster piraeus-charts/linstor-cluster \
  --version 1.3.2 -n piraeus-datastore -f werte-ha.yaml

Expected (first line):

Release "linstor-cluster" has been upgraded. Happy Helming!

Step 3 – is it running? The HA Controller runs as a DaemonSet: one pod on every matching node. get ds shows all DaemonSets of the namespace.

# on k0s-ctrl
kubectl -n piraeus-datastore get ds

Expected:

NAME               DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                       AGE
ha-controller      0         0         0       0            0           piraeus.io/managed-satellite=true   40s
linstor-csi-node   3         3         3       3            3           <none>                              24m

What you see: DESIRED 0 – the HA Controller is supposed to run on no node. The column NODE SELECTOR tells you why: it is the nodeSelector from Day 7, the label that deliberately no node carries so that the operator does not start its own satellites. It applies to every component you do not explicitly exempt – just like the CSI pods back then.

Step 4 – round 2: the exemption. You copy the values file and exempt the HA Controller from the nodeSelector.

# on k0s-ctrl
cp werte-ha.yaml werte-ha2.yaml
# on k0s-ctrl
nano werte-ha2.yaml
~/k0s-lab/tag21/werte-ha2.yaml (excerpt) changes in green
  highAvailabilityController:
    enabled: true
    podTemplate:
      spec:
        nodeSelector:
          piraeus.io/managed-satellite: null

null removes the inherited key from the nodeSelector – as on Day 7 for csiNode. Then you apply the new file and check the DaemonSet:

# on k0s-ctrl
helm upgrade linstor-cluster piraeus-charts/linstor-cluster \
  --version 1.3.2 -n piraeus-datastore -f werte-ha2.yaml
# on k0s-ctrl
kubectl -n piraeus-datastore get ds ha-controller

Expected:

NAME            DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
ha-controller   3         3         3       3            3           <none>          111s

What you see: DESIRED 3 – now an HA Controller runs on every worker.

Step 5 – what it does. The log shows what the HA Controller does. ds/ha-controller takes the log of one pod of the DaemonSet, --tail=4 shows only the last four lines.

# on k0s-ctrl
kubectl -n piraeus-datastore logs ds/ha-controller --tail=4

Expected (excerpt):

I1201 18:56:18.425223       8 agent.go:208] version: v1.3.4
I1201 18:56:18.425243       8 agent.go:209] node: k0s-w3
I1201 18:56:28.425802       8 agent.go:260] starting reconciliation
I1201 18:56:38.425823       8 agent.go:260] starting reconciliation

What you see: version v1.3.4, one agent per worker, and a reconciliation every ten seconds.

Remember: Every component you switch on in the Piraeus Operator inherits the nodeSelector from Day 7. After switching one on, always check DESIRED in kubectl get ds.

Save your progress? Sign up for free

Drill 5: The failure with emergency service

Where you are: on k0s-ctrl.

In this drill:

  • You cut the Grafana node off the network once more.
  • You measure how fast Grafana is back with the HA Controller.
  • You read in the log who acted.
  • You compare both failures.

Before you cut off – your prediction:

  1. With the HA Controller, how long until Grafana is ready again: under two minutes, about six minutes or over ten minutes?
  2. Do you have to do anything by hand this time?

Write down both answers. After step 2 you compare them with the measurement.

Step 1 – cut off. Repeat Drill 2, steps 1 and 2, on the node with the Grafana pod (k0s-w3). Name the timer netz-zurueck2 this time, because netz-zurueck has already been used.

Step 2 – watch as in Drill 2, step 3. In the author’s lab:

Time Event since the cut
18:56:53 k0s-w3 cut off 0 s
18:57:17 HA Controller reports the failure, taint drbd.linbit.com/lost-quorum 24 s
18:57:20 new pod on k0s-w1 27 s
18:57:39 node NotReady 46 s
18:58:00 new pod Running, not ready yet 67 s
18:58:27 Grafana ready (1/1) 94 s

Your prediction – the answer:

  1. In the lab Grafana was ready again after 94 seconds – the new pod was there after just 27 seconds, before Kubernetes even marked the node NotReady.
  2. No. No out-of-service taint, no command – the HA Controller did everything on its own.

Step 3 – who acted? The agent on one of the healthy nodes. You read its log of the last seven minutes (--since=7m):

# on k0s-ctrl
kubectl -n piraeus-datastore logs ha-controller-l7dtr --since=7m

Use the name of the HA Controller pod on k0s-w2 (kubectl -n piraeus-datastore get pods -o wide).

Expected (excerpt – look for the lines with evicting):

I1201 18:57:17.534061       6 reconcile_failover.go:142] resource 'pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200' on node 'k0s-w3' has failed, evicting
I1201 18:57:27.533347       6 reconcile_failover.go:142] resource 'pvc-2476ca45-4d93-4a9a-b8f0-3289ecf96200' on node 'k0s-w3' has failed, evicting

What you see: 24 seconds after the cut, the agent on k0s-w2 sees from the DRBD state that k0s-w3 has lost the resource and that the replica on k0s-w2 may take over – before Kubernetes even marks the node NotReady. It deletes the pod and releases the volume.

Step 4 – the sign on the door. Which taints does k0s-w3 carry now? jsonpath='{.spec.taints}' prints only the list of taints.

# on k0s-ctrl
kubectl get node k0s-w3 -o jsonpath='{.spec.taints}{"\n"}'

Expected:

[{"effect":"NoSchedule","key":"drbd.linbit.com/lost-quorum","timeAdded":"2026-12-01T18:57:17Z"},{"effect":"NoSchedule","key":"node.kubernetes.io/unreachable","timeAdded":"2026-12-01T18:57:39Z"},{"effect":"NoExecute","key":"node.kubernetes.io/unreachable","timeAdded":"2026-12-01T18:57:39Z"}]

What you see: First the HA Controller hung up its sign lost-quorum (18:57:17); 22 seconds later unreachable came from Kubernetes (18:57:39).

Step 5 – the data. Check as in Drill 2, step 7, whether the folder is still there. In the lab: ["Failover-Probe"].

Step 6 – bring it back. Lift the block and stop the timer as in Drill 3, step 1 (timer netz-zurueck2). This time there is no out-of-service taint to remove. Then you check the taints once more:

# on k0s-ctrl
kubectl get node k0s-w3 -o jsonpath='{.spec.taints}{"\n"}'

What else happened in the lab: The taint drbd.linbit.com/lost-quorum was still on the node one minute after the return (19:03:34) and was gone half an hour later. The HA Controller removes it itself – just not immediately. Until then Kubernetes schedules no new pods onto this node.

Both failures compared:

without HA Controller with HA Controller
new pod scheduled after 5 min 46 s after 27 s
manual work needed yes, out-of-service taint no
Grafana ready again after just over 12 min after 94 s
data complete complete

Remember: The emergency service cuts the outage from minutes with manual work to about a minute and a half without. It decides from the DRBD quorum – that is why quorum majority and a referee belong with it.

Save your progress? Sign up for free

Drill 6: Switch on NFS – and the version trap

Where you are: on k0s-ctrl, in ~/k0s-lab/tag21.

In this drill:

  • You switch on the NFS server on all workers.
  • You create a volume that two pods on different nodes write to.
  • You find out which node exports the volume.
  • You check that both pods write to the same file.

Step 1 – switch on the dispatch counter. You copy the last values file and switch on the NFS server in it.

# on k0s-ctrl
cp werte-ha2.yaml werte-nfs.yaml
# on k0s-ctrl
nano werte-nfs.yaml
~/k0s-lab/tag21/werte-nfs.yaml (excerpt) changes in green
  nfsServer:
    enabled: true
    podTemplate:
      spec:
        nodeSelector:
          piraeus.io/managed-satellite: null

This time you set the exemption from the nodeSelector right away – you know the trap from Drill 4. Then you apply the file and check the new DaemonSet:

# on k0s-ctrl
helm upgrade linstor-cluster piraeus-charts/linstor-cluster \
  --version 1.3.2 -n piraeus-datastore -f werte-nfs.yaml
# on k0s-ctrl
kubectl -n piraeus-datastore get ds linstor-csi-nfs-server

Expected:

NAME                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
linstor-csi-nfs-server   3         3         3       3            3           <none>          66s

Step 2 – one volume for many. A PVC with ReadWriteMany and a Deployment with two pods that spread over two nodes and each write one line to the same file every five seconds:

# on k0s-ctrl
nano rwx.yaml
~/k0s-lab/tag21/rwx.yaml new file
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gemeinsam
  namespace: grafana
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: linstor-replicated
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: schreiber
  namespace: grafana
spec:
  replicas: 2
  selector:
    matchLabels:
      app: schreiber
  template:
    metadata:
      labels:
        app: schreiber
    spec:
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: kubernetes.io/hostname
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels:
              app: schreiber
      containers:
        - name: schreiber
          image: busybox:1.38.0
          command: ["sh", "-c", "while true; do echo \"$(date +%T) $(hostname)\" >> /daten/log.txt; sleep 5; done"]
          volumeMounts:
            - name: daten
              mountPath: /daten
      volumes:
        - name: daten
          persistentVolumeClaim:
            claimName: gemeinsam
Part Meaning
accessModes: [ReadWriteMany] many pods on many nodes may write – LINSTOR CSI delivers that via NFS
storageClassName: linstor-replicated the same StorageClass as for Grafana; a separate NFS class is not needed
topologySpreadConstraints with maxSkew: 1 and kubernetes.io/hostname the two pods land on different nodes
command: […] a small program in the container: append time and pod name, wait five seconds. You do not type it in, it runs in the pod

You create the PVC and the Deployment:

# on k0s-ctrl
kubectl apply -f rwx.yaml

Then you check whether the volume has been created:

# on k0s-ctrl
kubectl -n grafana get pvc gemeinsam

Expected: Bound with RWX – if everything is right. If the CSI driver is still at v1.12.0, the PVC stays Pending. The next box shows what that looks like.

The version trap (seen in the lab). With CSI v1.12.0 and Operator v2.12.1 the PVC reported:

Warning  ProvisioningFailed  … CreateVolume failed for pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6: unable to export: failed to update config map for export 'pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6': configmaps "linstor-csi-nfs-server-reactor-config" is forbidden: User "system:serviceaccount:piraeus-datastore:linstor-csi-controller" cannot update resource "configmaps" in API group "" in the namespace "piraeus-datastore"

The permissions the operator gives the CSI Controller only allow get and patch on this ConfigMap – what CSI v1.13 uses. CSI v1.12 tries an update. You check the role like this:

# on k0s-ctrl
kubectl get clusterrole linstor-csi-controller \
  -o jsonpath='{range .rules[*]}{.resources} {.verbs}{"\n"}{end}'

Excerpt – the lines with configmaps and services:

["configmaps"] ["get","patch"]
["services"] ["get","update"]

The fix is not tinkering with the role but the matching version: LINSTOR 1.35 and CSI v1.13 as on Day 15. After that the CSI driver created the volume on its next attempt.

Step 3 – who exports, who writes? First you check on which nodes the writers run. -l app=schreiber selects the pods by their label.

# on k0s-ctrl
kubectl -n grafana get pods -l app=schreiber -o wide

Expected:

NAME                        READY   STATUS    RESTARTS   AGE   IP            NODE
schreiber-f5bcbf4d4-8pd6c   1/1     Running   0          14m   10.244.2.12   k0s-w3
schreiber-f5bcbf4d4-sj6fr   1/1     Running   0          14m   10.244.0.10   k0s-w2

Then you ask LINSTOR where the volume is InUse. Use the name of your PV – it is in kubectl -n grafana get pvc gemeinsam in the column VOLUME.

# on k0s-ctrl
linstor --no-utf8 --no-color resource list \
  -r pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6

Expected:

| pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 | k0s-ctrl | DRBD,STORAGE            | Unused | Ok    | Diskless | Yes  |
| pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 | k0s-w1   | DRBD,WRITECACHE,STORAGE | InUse  | Ok    | UpToDate | Yes  |
| pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 | k0s-w2   | DRBD,WRITECACHE,STORAGE | Unused | Ok    | UpToDate | Yes  |

What you see: The pods run on k0s-w2 and k0s-w3, but the volume is InUse on k0s-w1. That is where the NFS server runs that exports it. The pods do not write to DRBD but over NFS.

On a node with a writer pod you see how the volume is mounted. In the lab that was k0s-w3; take a node on which a writer runs for you.

# on k0s-w3
findmnt -t nfs4

Expected (excerpt):

linstor-csi-nfs.piraeus-datastore.svc:/pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 /var/lib/k0s/kubelet/pods/4632122d-fe52-4da0-999d-48557bd8678d/volumes/kubernetes.io~csi/pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6/mount

findmnt -t nfs4 shows only NFS mounts. The source is the service linstor-csi-nfs – the fixed house number behind which the dispatch counter can move.

Step 4 – do both write to the same file? You read the last six lines of the file. deploy/schreiber picks one of the two pods; the file is the same for both.

# on k0s-ctrl
kubectl -n grafana exec deploy/schreiber -- tail -6 /daten/log.txt

Expected:

19:22:34 schreiber-f5bcbf4d4-sj6fr
19:22:36 schreiber-f5bcbf4d4-8pd6c
19:22:40 schreiber-f5bcbf4d4-sj6fr
19:22:41 schreiber-f5bcbf4d4-8pd6c
19:22:45 schreiber-f5bcbf4d4-sj6fr
19:22:46 schreiber-f5bcbf4d4-8pd6c

What you see: The lines alternate between both pod names. Both pods write to the same file from two nodes.

Remember: With LINSTOR, ReadWriteMany means: DRBD on one node, NFS to all others. Which node exports is shown by InUse in linstor resource list – not by the node of the pods.

Save your progress? Sign up for free

Drill 7: The dispatch counter fails

Where you are: on k0s-ctrl.

In this drill:

  • You cut off the node that exports the volume.
  • You measure the write pause in the shared file.
  • You find out which node exports now.
  • You bring the node back.

Step 1 – cut off the exporting node. In the lab that was k0s-w1. For you it is the node with InUse from Drill 6, step 3. Repeat Drill 2, steps 1 and 2, on this node (timer netz-zurueck3). In the lab at 19:23:05.

Step 2 – wait and read the file. After two or three minutes you read the whole file:

# on k0s-ctrl
kubectl -n grafana exec deploy/schreiber -- cat /daten/log.txt

Expected (excerpt around the cut):

19:23:00 schreiber-f5bcbf4d4-sj6fr
19:23:01 schreiber-f5bcbf4d4-8pd6c
19:23:06 schreiber-f5bcbf4d4-8pd6c
19:23:05 schreiber-f5bcbf4d4-sj6fr
19:24:19 schreiber-f5bcbf4d4-8pd6c
19:24:24 schreiber-f5bcbf4d4-sj6fr
19:24:24 schreiber-f5bcbf4d4-8pd6c

What you see: Between 19:23:06 and 19:24:19 lines are missing. Both pods hung – no error message, no crash, they just waited – and then kept writing. The gap is 73 and 79 seconds. During this time another replica took over the export.

Step 3 – who exports now? The service linstor-csi-nfs always points to the pod that is currently exporting. Its EndpointSlices – the lists of addresses behind a service – reveal the address. -l kubernetes.io/service-name=linstor-csi-nfs selects the EndpointSlices of this service.

# on k0s-ctrl
kubectl -n piraeus-datastore get endpointslices \
  -l kubernetes.io/service-name=linstor-csi-nfs \
  -o jsonpath='{.items[*].endpoints[*].addresses}{"\n"}'

Expected:

["10.244.0.8"]

Before the cut this showed 10.244.1.10. Yours is a different address – put it into the next command. A field selector shows which pod the new address belongs to:

# on k0s-ctrl
kubectl -n piraeus-datastore get pods -o wide \
  --field-selector status.podIP=10.244.0.8

--field-selector status.podIP=<ip> filters for the pod with exactly this IP.

Expected (excerpt):

NAME                           READY   STATUS    RESTARTS   AGE   IP           NODE
linstor-csi-nfs-server-64cn9   1/1     Running   0          28m   10.244.0.8   k0s-w2

The service now points to the NFS server pod on k0s-w2.

Step 4 – bring it back as in Drill 3, step 1, with timer netz-zurueck3. Then you ask LINSTOR about the replicas:

# on k0s-ctrl
linstor --no-utf8 --no-color resource list \
  -r pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6

Expected:

| pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 | k0s-ctrl | DRBD,STORAGE            | Unused | Ok    | Diskless | Yes  |
| pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 | k0s-w1   | DRBD,WRITECACHE,STORAGE | Unused | Ok    | UpToDate | Yes  |
| pvc-b1e1d4c4-1a13-4aa3-ab7e-f7662d4390f6 | k0s-w2   | DRBD,WRITECACHE,STORAGE | InUse  | Ok    | UpToDate | Yes  |

The export stays on k0s-w2, k0s-w1 is a healthy replica again. There is no switch back.

Remember: If the dispatch counter fails, the NFS customers wait just over a minute and then keep writing – without restarting the pods. The switchover is done by drbd-reactor in the NFS server pod, not by the HA Controller.

Save your progress? Sign up for free

If it doesn’t work

  • ha-controller or linstor-csi-nfs-server with DESIRED 0: the exemption from the nodeSelector is missing in the podTemplate (Drill 4).
  • RWX PVC stays Pending with cannot update resource "configmaps": the CSI driver is too old for the operator. First LINSTOR 1.35, then CSI v1.13 (Day 15).
  • helm upgrade reports failed calling webhook "vlinstorcluster.kb.io" … context deadline exceeded: In the lab shortly after a cut-off node returned. The konnectivity agent of that node had restarted nine times during the cut; the API server’s webhook call went nowhere. A second attempt one minute later went through.
  • Briefly connection refused on 10.10.0.100:3370 when creating a volume: the controller is just moving (Day 6). The CSI driver retries on its own.

Checkpoint

# on k0s-ctrl
kubectl -n piraeus-datastore get ds

Expected: ha-controller, linstor-csi-nfs-server and linstor-csi-node, each with 3 in DESIRED and READY.

# on k0s-ctrl
kubectl -n grafana get pvc

Expected: grafana (RWO) and gemeinsam (RWX), both Bound.

# on k0s-ctrl
kubectl get nodes \
  -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints[*].key

Expected: no taints on the workers.

Cleanup

# on k0s-ctrl
kubectl delete -f rwx.yaml
# on k0s-ctrl
helm uninstall grafana -n grafana
# on k0s-ctrl
kubectl delete namespace grafana

You can leave the HA Controller and the NFS server switched on. To go back to the state of Day 15, apply ~/k0s-lab/tag15/werte-4.yaml again with helm upgrade.

Test yourself

  1. Why does the new Grafana pod hang without the HA Controller, although Kubernetes reschedules it after six minutes?
  2. How did the HA Controller detect the failure – and why earlier than Kubernetes?
  3. Why did the HA Controller start on no node after it was first switched on?
  4. Which node writes to DRBD for an RWX volume?
  5. What did the two writer pods notice of the NFS export failing?

Answers:

  1. The volume is RWO and still counts as attached to k0s-w3 (VolumeAttachment). Kubernetes does not know whether the node is really down and does not release the volume until the out-of-service taint confirms it.
  2. From the DRBD state: the replica on k0s-w3 was gone, the one on another node was allowed to take over (quorum). DRBD notices that within seconds, Kubernetes waits for missing kubelet reports.
  3. The global nodeSelector from Day 7 also applies to the HA Controller; without null in the podTemplate no node matches.
  4. The node on which the NFS server exports – in linstor resource list the one with InUse. The pods write over NFS.
  5. Only a pause of just over a minute: they hung while writing and then carried on without a restart.

Interview Note

“How quickly is your application back after a node failure?” – Give numbers and the mechanism: without help, Kubernetes reschedules after about five minutes, and an RWO volume then still needs a manual confirmation. A storage-aware controller like the Piraeus HA Controller decides from the replication quorum and manages it in seconds – in the lab 94 seconds until Grafana was ready again.

Enterprise Note

Automatic failover is only as good as the certainty that the old node no longer writes. The HA Controller relies on the DRBD quorum and suspend-io from the StorageClass for that. Companies additionally require a fencing mechanism (power-off via IPMI or the hypervisor) before data is written on a second node. For RWX over NFS: the pause during the switchover hits all clients at once – applications must tolerate hanging writes. Services that tolerate only one writer – such as Prometheus – do not belong on RWX; Day 22 shows how to make them survive a node failure with an RWO volume and fencing.

Summary

You installed Grafana with Helm from the new chart grafana-community/grafana on a volume with two replicas and cut its node off the network. Without the HA Controller, Kubernetes rescheduled after 5 minutes 46 seconds, and only the out-of-service taint brought Grafana back after just over 12 minutes. With the HA Controller – after the familiar nodeSelector trap – Grafana was ready again after 94 seconds, without any manual work. With the NFS server, two pods on different nodes write to the same volume; when the exporting node failed, they waited just over a minute and then kept writing. RWX only worked with LINSTOR 1.35 and CSI v1.13.

Commands at a glance

Command What it does Parameters
helm repo add <name> <url> add a chart repository –
helm show readme <chart> read a chart’s description –
helm search repo <chart> --versions available versions --versions all versions
helm install <name> <chart> --version <v> -n <ns> -f <werte> install a chart -f values file
helm upgrade linstor-cluster … -f werte-N.yaml switch Piraeus components –
kubectl -n <ns> get pods -o wide -w watch pods -w print changes continuously
kubectl get volumeattachments -o custom-columns=… which node a volume is attached to –
kubectl taint node <node> node.kubernetes.io/out-of-service=nodeshutdown:NoExecute confirm a failure - at the end removes the taint
kubectl -n piraeus-datastore get ds DaemonSets with DESIRED and NODE SELECTOR –
kubectl -n piraeus-datastore logs ds/ha-controller HA Controller log --since, --tail
sudo k0s ctr -n k8s.io images pull <image> pull an image onto a node in advance -n k8s.io Kubernetes namespace
findmnt -t nfs4 NFS mounts of a node -t file system type
kubectl -n piraeus-datastore get endpointslices -l kubernetes.io/service-name=linstor-csi-nfs … where the NFS service currently points –
kubectl get pods -o wide --field-selector status.podIP=<ip> find the pod for an IP --field-selector field filter

Contents

More