Tag 4: Der LINSTOR-Cluster – Nodes, Netze, Witness, Zonen
Ziel: Alle vier Satellites sind beim Controller registriert, DRBD läuft zwischen den Workern über das Storage-Netz und zur Witness über das Management-Netz, und jeder Worker kennt seine Zone. · Dauer: ca. 45 min · Voraussetzung: Tag 3
Briefing
- Der
linstor-Client spricht per REST mit dem Controller auf Port 3370. Wo der Controller steht, legt/etc/linstor/linstor-client.conffest. - Die Adresse bei
node createist die Standard-Schnittstelle des Nodes: Über sie spricht der Controller mit dem Satellite, und über sie läuft DRBD. - Worker registrierst du mit ihrer Storage-IP, die Witness mit ihrer Management-IP. Für Worker ↔︎ Witness legst du einen eigenen Pfad über das Management-Netz an.
- Zonen kennt LINSTOR nicht. Du hängst sie als freie Eigenschaft
Aux/zonean die Nodes.
k0s-w1 ── 10.10.0.x (default) ── k0s-w2 ── 10.10.0.x ── k0s-w3
\ | /
`── 172.16.0.x (mgmt) ───── k0s-ctrl ───── (mgmt) ─'
Witness
Drill 1: Den Client einrichten
Ab heute laufen alle linstor-Befehle auf deinem
Arbeitsplatz k0s-ctrl. Ohne Konfiguration fragt der Client
localhost:
# auf k0s-ctrl
mkdir -p ~/k0s-lab/tag04 && cd ~/k0s-lab/tag04
linstor node listErwartet:
Error: Unable to connect to linstor://localhost:3370: [Errno 111] Connection refused
Der Controller läuft auf k0s-w1. k0s-ctrl
hat keine Adresse im Storage-Netz und erreicht ihn deshalb über die
Management-IP:
# auf k0s-ctrl
sudo tee /etc/linstor/linstor-client.conf <<'EOF'
[global]
controllers=172.16.0.186
EOF
linstor controller version
linstor --no-utf8 --no-color node listErwartet:
[global]
controllers=172.16.0.186
linstor controller 1.34.2; GIT-hash: 92d55e45f88b4ef96f5ee468677f395513b2eee2
+-------------------------------------+
| Node | NodeType | Addresses | State |
|=====================================|
+-------------------------------------+
Die Worker bekommen die Storage-IP von k0s-w1:
# auf k0s-w1
sudo tee /etc/linstor/linstor-client.conf >/dev/null <<'EOF'
[global]
controllers=10.10.0.11
EOF
linstor controller versionErwartet:
linstor controller 1.34.2; GIT-hash: 92d55e45f88b4ef96f5ee468677f395513b2eee2
Wiederhole das auf k0s-w2 und k0s-w3. An
Tag 6 ersetzt die VIP 10.10.0.100 die feste Adresse.
Fortschritt speichern? Kostenlos registrieren
Drill 2: Nodes registrieren
# auf k0s-ctrl
linstor node create k0s-w1 10.10.0.11 --node-type satellite
linstor node create k0s-w2 10.10.0.12 --node-type satellite
linstor node create k0s-w3 10.10.0.13 --node-type satellite
linstor node create k0s-ctrl 172.16.0.176 --node-type satellite
linstor --no-utf8 --no-color node listErwartet (gekürzt):
SUCCESS:
New node 'k0s-w1' registered.
SUCCESS:
Node 'k0s-w1' authenticated
Details:
Supported storage providers: [diskless, lvm, lvm_thin, file, file_thin, ...]
Supported resource layers : [drbd, luks, writecache, cache, bcache, storage]
Unsupported storage providers:
ZFS: 'cat /sys/module/zfs/version' returned with exit code 1
...
+----------------------------------------------------------------------+
| Node | Platform | NodeType | Addresses | State |
|======================================================================|
| k0s-ctrl | LINUX | SATELLITE | 172.16.0.176:3366 (PLAIN) | Online |
| k0s-w1 | LINUX | SATELLITE | 10.10.0.11:3366 (PLAIN) | Online |
| k0s-w2 | LINUX | SATELLITE | 10.10.0.12:3366 (PLAIN) | Online |
| k0s-w3 | LINUX | SATELLITE | 10.10.0.13:3366 (PLAIN) | Online |
+----------------------------------------------------------------------+
Nimm als Node-Namen den Hostnamen: CSI-Treiber und Kubernetes
verbinden die beiden Welten später über diesen Namen. Die Meldungen zu
ZFS, SPDK und NVMe-oF sind harmlos: Diese Werkzeuge fehlen schlicht.
Wichtig sind lvm, drbd und
writecache.
Fortschritt speichern? Kostenlos registrieren
Drill 3: Was die Nodes können und wer mit wem spricht
# auf k0s-ctrl
linstor --no-utf8 --no-color node infoErwartet (gekürzt):
+-----------------------------------------------------------------------------...
| Node | Diskless | LVM | LVMThin | ZFS/Thin | File/Thin | SPDK | Remote S...
|=============================================================================...
| k0s-ctrl | + | + | + | - | + | - | + ...
| k0s-w1 | + | + | + | - | + | - | + ...
...
+-----------------------------------------------------------------------+
| Node | DRBD | LUKS | NVMe | Cache | BCache | WriteCache | Storage |
|=======================================================================|
| k0s-ctrl | + | + | - | + | + | + | + |
| k0s-w1 | + | + | - | + | + | + | + |
...
Die Verbindung zum Satellite baut der Controller auf, nicht umgekehrt:
# auf k0s-ctrl
ssh k0s-w2 'sudo ss -tnp | grep :3366'
sudo ss -tnp | grep :3366Erwartet (gekürzt):
ESTAB 0 0 [::ffff:10.10.0.12]:3366 [::ffff:10.10.0.11]:55394 users:(("java",...
ESTAB 0 0 [::ffff:172.16.0.176]:3366 [::ffff:172.16.0.186]:57074 users:(("java",...
Zu k0s-w2 über das Storage-Netz, zur Witness über das
Management-Netz – genau die Adressen aus node create. Eine
Firewall muss also 3366 vom Controller zu jedem Satellite öffnen.
Fortschritt speichern? Kostenlos registrieren
Drill 4: Ein Pfad für die Witness
Für eine DRBD-Verbindung zwischen k0s-w1 und
k0s-ctrl würde k0s-w1 seine
Standard-Schnittstelle 10.10.0.11 nehmen. Die Witness kann
darauf nicht antworten – sie hat keine Adresse in diesem Netz. Jeder
Node bekommt deshalb eine zweite Schnittstelle mgmt, und
für die drei Paare Worker ↔︎ Witness legst du einen Pfad an:
# auf k0s-ctrl
linstor node interface create k0s-w1 mgmt 172.16.0.186
linstor node interface create k0s-w2 mgmt 172.16.0.36
linstor node interface create k0s-w3 mgmt 172.16.0.72
linstor node interface create k0s-ctrl mgmt 172.16.0.176
linstor --no-utf8 --no-color node interface list k0s-w1Erwartet (gekürzt):
SUCCESS:
New netInterface 'mgmt' on node 'k0s-w1' registered.
...
+-----------------------------------------------------------------+
| k0s-w1 | NetInterface | IP | Port | EncryptionType |
|=================================================================|
| + StltCon | default | 10.10.0.11 | 3366 | PLAIN |
| + | mgmt | 172.16.0.186 | | |
+-----------------------------------------------------------------+
StltCon markiert die Schnittstelle, über die der
Controller den Satellite erreicht. Jetzt die Pfade:
# auf k0s-ctrl
linstor node-connection path create k0s-w1 k0s-ctrl witness mgmt mgmt
linstor node-connection path create k0s-w2 k0s-ctrl witness mgmt mgmt
linstor node-connection path create k0s-w3 k0s-ctrl witness mgmt mgmt
linstor --no-utf8 --no-color node-connection listErwartet (gekürzt):
SUCCESS:
Successfully set property key(s): Paths/witness/k0s-w1,Paths/witness/k0s-ctrl
...
+-----------------------------------------------+
| Node A | Node B | Properties |
|===============================================|
| k0s-ctrl | k0s-w1 | k0s-ctrl=mgmt,k0s-w1=mgmt |
| k0s-ctrl | k0s-w2 | k0s-ctrl=mgmt,k0s-w2=mgmt |
| k0s-ctrl | k0s-w3 | k0s-ctrl=mgmt,k0s-w3=mgmt |
+-----------------------------------------------+
witness ist nur der Name des Pfads, die beiden
mgmt sind die Schnittstellen auf Node A und Node B.
Zwischen den Workern gibt es keinen Pfad, dort bleibt es beim
Storage-Netz.
Fortschritt speichern? Kostenlos registrieren
Drill 5: Zonen
# auf k0s-ctrl
linstor node set-property k0s-w1 Aux/zone a
linstor node set-property k0s-w2 Aux/zone b
linstor node set-property k0s-w3 Aux/zone a
linstor --no-utf8 --no-color node list-properties k0s-w2
linstor --no-utf8 --no-color node list -s Aux/zone=ZoneErwartet (gekürzt):
+---------------------------+
| Key | Value |
|===========================|
| Aux/zone | b |
| CurStltConnName | default |
| NodeUname | k0s-w2 |
+---------------------------+
+-----------------------------------------------------------------------------+
| Node | Platform | NodeType | Addresses | State | Zone |
|=============================================================================|
| k0s-ctrl | LINUX | SATELLITE | 172.16.0.176:3366 (PLAIN) | Online | |
| k0s-w1 | LINUX | SATELLITE | 10.10.0.11:3366 (PLAIN) | Online | a |
| k0s-w2 | LINUX | SATELLITE | 10.10.0.12:3366 (PLAIN) | Online | b |
| k0s-w3 | LINUX | SATELLITE | 10.10.0.13:3366 (PLAIN) | Online | a |
+-----------------------------------------------------------------------------+
Aux/ markiert eigene Eigenschaften. LINSTOR wertet sie
nicht aus, aber Platzierungsregeln können sich darauf beziehen (Tag 5).
Die Zonen entsprechen den Kubernetes-Labels
topology.kubernetes.io/zone aus Tag 1 – gepflegt werden sie
an zwei Stellen.
Fortschritt speichern? Kostenlos registrieren
Drill 6: Eine Ressource von Hand
Eine Ressource braucht Platz. Lege dafür den Pool
pool_data auf der VG data an – was Pools sonst
noch können, kommt an Tag 5.
# auf k0s-ctrl
linstor storage-pool create lvm k0s-w1 pool_data data
linstor storage-pool create lvm k0s-w2 pool_data data
linstor storage-pool create lvm k0s-w3 pool_data data
linstor --no-utf8 --no-color storage-pool list -s pool_data | cut -c1-88Erwartet (gekürzt):
+---------------------------------------------------------------------------------------
| StoragePool | Node | Driver | PoolName | FreeCapacity | TotalCapacity | CanSnapshots
|=======================================================================================
| pool_data | k0s-w1 | LVM | data | 30.00 GiB | 30.00 GiB | False
| pool_data | k0s-w2 | LVM | data | 30.00 GiB | 30.00 GiB | False
| pool_data | k0s-w3 | LVM | data | 30.00 GiB | 30.00 GiB | False
+---------------------------------------------------------------------------------------
Jetzt die Ressource in drei Schritten: Definition (der Name), Volume-Definition (die Größe), Ressourcen (wo sie liegt).
# auf k0s-ctrl
linstor resource-definition create tag04-hand
linstor volume-definition create tag04-hand 200M
linstor resource create k0s-w1 k0s-w2 tag04-hand --storage-pool pool_data
linstor --no-utf8 --no-color resource list -r tag04-handErwartet (gekürzt):
INFO:
Tie breaker resource 'tag04-hand' created on k0s-ctrl
INFO:
Resource-definition property 'DrbdOptions/Resource/quorum' updated from undefin...
...
+-------------------------------------------------------------------------------+
| ResourceName | Node | Layers | Usage | Conns | State | Vote |
|===============================================================================|
| tag04-hand | k0s-ctrl | DRBD,STORAGE | Unused | Ok | Diskless | Yes |
| tag04-hand | k0s-w1 | DRBD,STORAGE | Unused | Ok | UpToDate | Yes |
| tag04-hand | k0s-w2 | DRBD,STORAGE | Unused | Ok | Inconsistent | Yes |
+-------------------------------------------------------------------------------+
Du hast zwei Kopien bestellt, LINSTOR hat eine dritte ohne
Daten dazugelegt: den Tiebreaker. Mit drei Stimmen gibt es bei
einer Netztrennung eine Mehrheit, deshalb schaltet LINSTOR auch gleich
quorum=majority ein. Inconsistent auf
k0s-w2 ist der erste Resync, nach wenigen Sekunden steht
dort UpToDate.
Wo der Tiebreaker landet, entscheidet LINSTOR ohne Zonenregel selbst
– im Labor hier auf k0s-ctrl, bei anderen Versuchen auch
auf k0s-w3 (Tag 5). Drill 7 braucht die Verbindung zur
Witness. Steht der Tiebreaker bei dir auf k0s-w3, bestellst
du die diskless Kopie auf der Witness ausdrücklich. Den überzähligen
Tiebreaker räumt LINSTOR dann selbst ab:
# auf k0s-ctrl
linstor resource create k0s-ctrl tag04-hand --drbd-diskless
linstor --no-utf8 --no-color resource list -r tag04-handErwartet (gekürzt):
INFO:
Tie breaker marked for deletion
...
SUCCESS:
Cleaning up 'tag04-hand' on 'k0s-w3'
...
Node: k0s-w3, Resource: tag04-hand deletion complete.
...
| tag04-hand | k0s-ctrl | DRBD,STORAGE | Unused | Ok | Diskless | Yes |
| tag04-hand | k0s-w1 | DRBD,STORAGE | Unused | Ok | UpToDate | Yes |
| tag04-hand | k0s-w2 | DRBD,STORAGE | Unused | Ok | UpToDate | Yes |
Tipp: Leg immer zuerst die Kopien mit Daten an. Eine diskless Ressource als allererste Kopie lehnte LINSTOR 1.34.2 im Labor mit
Linstor/Drbd/InitialUptoDateOn was unexpectedly nullund einem Fehlerbericht (Error-Report, Tag 9) ab.
Fortschritt speichern? Kostenlos registrieren
Drill 7: Wirkt der Pfad?
# auf k0s-ctrl
ssh k0s-w2 'sudo drbdsetup show tag04-hand' | grep -E '_(this|remote)_host ipv4'
ssh k0s-w2 'sudo ss -tn | grep :7000'Erwartet:
_this_host ipv4 172.16.0.36:7000;
_remote_host ipv4 172.16.0.176:7000;
_this_host ipv4 10.10.0.12:7000;
_remote_host ipv4 10.10.0.11:7000;
ESTAB 0 0 10.10.0.12:41131 10.10.0.11:7000
ESTAB 0 0 10.10.0.12:7000 10.10.0.11:51889
ESTAB 0 0 172.16.0.36:45401 172.16.0.176:7000
ESTAB 0 0 172.16.0.36:7000 172.16.0.176:58667
Zur Witness über 172.16.0.x, zum anderen Worker über
10.10.0.x. Port 7000 ist der erste DRBD-Port, jede weitere
Ressource bekommt auf jedem Node den nächsten freien. Jetzt der Beweis,
dass die Daten wirklich auf beiden Seiten liegen:
# auf k0s-w1
sudo drbdadm primary tag04-hand
sudo mkfs.ext4 -q /dev/drbd/by-res/tag04-hand/0
sudo mount /dev/drbd/by-res/tag04-hand/0 /mnt
echo "von k0s-w1" | sudo tee /mnt/gruss.txt
sudo drbdadm status tag04-hand
sudo umount /mnt
sudo drbdadm secondary tag04-handErwartet:
von k0s-w1
tag04-hand role:Primary
disk:UpToDate open:yes
k0s-ctrl role:Secondary
peer-disk:Diskless peer-client:yes
k0s-w2 role:Secondary
peer-disk:UpToDate
# auf k0s-w2
sudo drbdadm primary tag04-hand
sudo mount /dev/drbd/by-res/tag04-hand/0 /mnt
cat /mnt/gruss.txt
sudo umount /mnt
sudo drbdadm secondary tag04-handErwartet:
von k0s-w1
Primary darf immer nur einer sein. Den Wechsel übernehmen später drbd-reactor (Tag 6) und für PVCs DRBD selbst, sobald der CSI-Treiber das Gerät öffnet (Tag 8) – von Hand machst du das nur zum Verstehen.
Fortschritt speichern? Kostenlos registrieren
Übung: Speed-Drills
- Zeig alle Nodes mit ihrer Zone in einer Tabelle. Zeitziel: 20 s
- Zeig nur die Nodes der Zone a. Zeitziel: 20 s
- Zeig die Schnittstellen der Witness. Zeitziel: 15 s
- Zeig, über welche Adressen
k0s-w1die Ressourcetag04-handmit der Witness verbindet. Zeitziel: 30 s
Lösung
# auf k0s-ctrl
linstor --no-utf8 --no-color node list -s Aux/zone=Zone
linstor --no-utf8 --no-color node list --props Aux/zone=a
linstor --no-utf8 --no-color node interface list k0s-ctrl
ssh k0s-w1 'sudo drbdsetup show tag04-hand' | grep -E '_(this|remote)_host ipv4' \
| head -2Erwartet (gekürzt):
...
| k0s-w1 | LINUX | SATELLITE | 10.10.0.11:3366 (PLAIN) | Online |
| k0s-w3 | LINUX | SATELLITE | 10.10.0.13:3366 (PLAIN) | Online |
...
| + StltCon | default | 172.16.0.176 | 3366 | PLAIN |
| + | mgmt | 172.16.0.176 | | |
...
_this_host ipv4 172.16.0.186:7000;
_remote_host ipv4 172.16.0.176:7000;
Fortschritt speichern? Kostenlos registrieren
Kontrollpunkt
# auf k0s-ctrl
linstor --no-utf8 --no-color node list -s Aux/zone=ZoneErwartet: vier Nodes Online, Worker mit
10.10.0.x, k0s-ctrl mit
172.16.0.176, Zonen a, b, a.
# auf k0s-ctrl
linstor --no-utf8 --no-color node-connection listErwartet: drei Zeilen
k0s-ctrl | k0s-wN | k0s-ctrl=mgmt,k0s-wN=mgmt.
# auf k0s-ctrl
linstor --no-utf8 --no-color storage-pool list -s pool_data | cut -c1-88Erwartet: pool_data auf
k0s-w1 bis k0s-w3, je 30 GiB.
Challenge
Ein Kollege hat den Pfad zwischen k0s-w3 und der Witness
gelöscht. Stell das nach, lege eine Ressource tag04-ohne
mit Kopien auf k0s-w1 und k0s-w3 und einer
diskless Kopie auf k0s-ctrl an, finde den Fehler in LINSTOR
und DRBD und repariere ihn ohne die Ressource zu löschen.
Hinweis: linstor resource list zeigt in
der Spalte Conns, wer wen nicht erreicht.
Lösung
# auf k0s-ctrl
linstor node-connection path delete k0s-w3 k0s-ctrl witness
linstor resource-definition create tag04-ohne
linstor volume-definition create tag04-ohne 100M
linstor resource create k0s-w1 k0s-w3 tag04-ohne --storage-pool pool_data
linstor resource create k0s-ctrl tag04-ohne --drbd-diskless
linstor --no-utf8 --no-color resource list -r tag04-ohne | cut -c1-88
ssh k0s-w3 'sudo drbdsetup show tag04-ohne' | grep -A3 '_peer_node_id 3'Erwartet (gekürzt):
+---------------------------------------------------------------------------------------
| ResourceName | Node | Layers | Usage | Conns | State | Vo
|=======================================================================================
| tag04-ohne | k0s-ctrl | DRBD,STORAGE | Unused | Connecting(k0s-w3) | Diskless | Ye
| tag04-ohne | k0s-w1 | DRBD,STORAGE | Unused | Ok | UpToDate | Ye
| tag04-ohne | k0s-w3 | DRBD,STORAGE | Unused | Connecting(k0s-ctrl) | UpToDate | Ye
+---------------------------------------------------------------------------------------
_peer_node_id 3;
path {
_this_host ipv4 10.10.0.13:7001;
_remote_host ipv4 172.16.0.176:7001;
k0s-w3 ruft die Witness von seiner Storage-IP aus an,
die Antwort findet keinen Weg zurück. Reparatur im laufenden
Betrieb:
# auf k0s-ctrl
linstor node-connection path create k0s-w3 k0s-ctrl witness mgmt mgmt
ssh k0s-w3 'sudo drbdadm status tag04-ohne'Erwartet:
tag04-ohne role:Secondary
disk:UpToDate open:no
k0s-ctrl role:Secondary
peer-disk:Diskless peer-client:yes
k0s-w1 role:Secondary
peer-disk:UpToDate
LINSTOR passt die laufende Ressource sofort an, DRBD verbindet sich neu.
Fortschritt speichern? Kostenlos registrieren
Aufräumen
# auf k0s-ctrl
linstor resource-definition delete tag04-hand
linstor resource-definition delete tag04-ohne
linstor --no-utf8 --no-color resource listErwartet: eine leere Tabelle. Nodes, Schnittstellen,
Pfade, Zonen und pool_data bleiben.
Interview-Notiz
- Über welches Netz läuft DRBD in LINSTOR? Über die
Standard-Schnittstelle aus
node create, außer für Node-Paare mit einem Node-Connection-Path. - Wozu eine Witness? Sie hält keine Daten, stimmt aber beim Quorum mit. Mit zwei Datenkopien plus Witness gibt es bei jeder Netztrennung eine eindeutige Mehrheit.
- Woher weiß LINSTOR von Zonen? Gar nicht von selbst. Zonen
sind
Aux/-Eigenschaften, auf die sich Platzierungsregeln wie--replicas-on-differentbeziehen.
Enterprise-Notiz
- Storage-Netz redundant: zwei NICs als Bond oder zwei DRBD-Pfade pro
Node-Paar (
node-connection path createmehrfach). Fällt ein Pfad aus, nimmt DRBD den anderen. - Controller ↔︎ Satellite mit TLS
(
--communication-type SSL) und eigenem Keystore, sobald das Netz nicht exklusiv ist. - Die Witness steht wirklich am dritten Standort, mit eigener Stromversorgung und eigenem Uplink. Eine Witness im selben Rack hilft bei einem Rack-Ausfall nicht.
- Firewall: 3366/tcp vom Controller zu allen Satellites, 3370/tcp zum Controller, 7000–7999/tcp zwischen allen Nodes einer Ressource.