このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
06_virtualization:05_container:16_kubernetes_linstor [2022/04/21 13:33] – matsui | 06_virtualization:05_container:16_kubernetes_linstor [2022/07/07 23:06] (現在) – [3. Linstorインストール] matsui | ||
---|---|---|---|
行 35: | 行 35: | ||
</ | </ | ||
- | ====== 3. Linstorインストール ====== | + | ====== 3. LINSTORインストール ====== |
今回は3台でlinstor-controllerを冗長化するので、3台とも全部インストール | 今回は3台でlinstor-controllerを冗長化するので、3台とも全部インストール | ||
行 45: | 行 45: | ||
systemctl disable linstor-controller | systemctl disable linstor-controller | ||
+ | |||
+ | ===== 自動補完 ===== | ||
+ | |||
+ | # source / | ||
+ | # source / | ||
====== 4. Linstor初期化 ====== | ====== 4. Linstor初期化 ====== | ||
行 155: | 行 160: | ||
- | ===== 6.冗長化構成 ===== | + | ====== 6.冗長化構成 |
linstorの情報は、/ | linstorの情報は、/ | ||
行 163: | 行 168: | ||
これで、3つのノードどれかで、linstore-controllerが起動して、その他のlinstore-controllerは起動しないという設定が可能となります。 | これで、3つのノードどれかで、linstore-controllerが起動して、その他のlinstore-controllerは起動しないという設定が可能となります。 | ||
- | ==== linstor_dbボリュームの用意 ==== | + | ===== linstor_dbボリュームの用意 |
linstor resource-definition create linstor_db | linstor resource-definition create linstor_db | ||
行 171: | 行 176: | ||
linstor resource create linstor_db -s linstor-pool --auto-place 3 | linstor resource create linstor_db -s linstor-pool --auto-place 3 | ||
- | === もしlinstor-controllerが動いている場合は、disableにして停止 === | + | ==== もしlinstor-controllerが動いている場合は、disableにして停止 |
systemctl disable --now linstor-controller | systemctl disable --now linstor-controller | ||
- | === linstore_dbマウントするsystemd用意 === | + | ==== linstore_dbマウントするsystemd用意 |
< | < | ||
行 189: | 行 194: | ||
</ | </ | ||
- | === linstor_dbをマウントしてlinstor-controller起動 === | + | ==== linstor_dbをマウントしてlinstor-controller起動 |
< | < | ||
行 202: | 行 207: | ||
</ | </ | ||
- | ==== drbd-reactor用意 ==== | + | ===== drbd-reactor用意 |
※下記の手順は全てのノードで実行する。 | ※下記の手順は全てのノードで実行する。 | ||
- | === install === | + | ==== install |
apt install drbd-reactor | apt install drbd-reactor | ||
- | === 起動順のファイル作成 === | + | ==== 起動順のファイル作成 |
< | < | ||
行 220: | 行 225: | ||
</ | </ | ||
- | === 一度drbd-reactor再起動 === | + | ==== 一度drbd-reactor再起動 |
systemctl restart drbd-reactor | systemctl restart drbd-reactor | ||
systemctl enable drbd-reactor | systemctl enable drbd-reactor | ||
- | ==== linstor-satellite修正 ==== | + | ===== linstor-satellite修正 |
linstor_dbボリュームに変更を加えないように設定変更 | linstor_dbボリュームに変更を加えないように設定変更 | ||
行 235: | 行 240: | ||
</ | </ | ||
- | ==== linstor-client.conf修正 ==== | + | ===== linstor-client.conf修正 |
どのノードでlinstor-controllerが動いていても良いように、linstor-client.confを修正しておく。 | どのノードでlinstor-controllerが動いていても良いように、linstor-client.confを修正しておく。 | ||
行 246: | 行 251: | ||
- | ==== 確認 ==== | + | ===== 確認 |
linstor_dbがPrimaryのノードでしか、linstor-controllerが起動しない事を確認 | linstor_dbがPrimaryのノードでしか、linstor-controllerが起動しない事を確認 | ||
行 275: | 行 280: | ||
linstor:// | linstor:// | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== 確認(正常な動作) ===== | ||
+ | |||
+ | # cat / | ||
+ | version: 9.0.32-1 (api: | ||
+ | # linstor --version | ||
+ | linstor 1.13.0 | ||
+ | # drbd-reactor --version | ||
+ | drbd-reactor 0.6.0 | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | # linstor controller which | ||
+ | linstor:// | ||
+ | |||
+ | ## ノード再起動や、drbd-reactorを停止した状態で、linstor-controllerが停止 | ||
+ | node02:~# systemctl stop drbd-reactor.service | ||
+ | node02:~# systemctl stop linstor-controller.service | ||
+ | |||
+ | ## 即時に別のノードで、linstor-controllerが起動 | ||
+ | node01:~# linstor controller which | ||
+ | linstor:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== 7.Kubernetsから接続 ====== | ||
+ | |||
+ | |||
+ | ==== 大前提条件 ==== | ||
+ | |||
+ | Kubernetes helm インストール時下記の3つがlinstorインストールの前提の条件です。 | ||
+ | - kubernetes controller からPodのIPに通信できる事 | ||
+ | - Pod内から外部へ通信可能 | ||
+ | - Pod内で名前解決可能 | ||
+ | |||
+ | < | ||
+ | root@linstor-master: | ||
+ | NAME READY | ||
+ | alpine-test | ||
+ | root@linstor-master: | ||
+ | PING 10.224.1.2 (10.224.1.2) 56(84) bytes of data. | ||
+ | 64 bytes from 10.224.1.2: icmp_seq=1 ttl=63 time=0.959 ms | ||
+ | 64 bytes from 10.224.1.2: icmp_seq=2 ttl=63 time=0.679 ms | ||
+ | 64 bytes from 10.224.1.2: icmp_seq=3 ttl=63 time=0.506 ms | ||
+ | |||
+ | --- 10.224.1.2 ping statistics --- | ||
+ | 3 packets transmitted, | ||
+ | rtt min/ | ||
+ | |||
+ | root@linstor-master: | ||
+ | PING fl8.jp (182.48.51.190): | ||
+ | 64 bytes from 182.48.51.190: | ||
+ | 64 bytes from 182.48.51.190: | ||
+ | 64 bytes from 182.48.51.190: | ||
+ | |||
+ | --- fl8.jp ping statistics --- | ||
+ | 3 packets transmitted, | ||
+ | round-trip min/avg/max = 8.532/ | ||
+ | </ | ||
+ | ==== secret登録 ==== | ||
+ | |||
+ | < | ||
+ | kubectl create secret docker-registry drbdiocred --docker-server=drbd.io \ | ||
+ | --docker-username=[User] --docker-password=[Pass] | ||
+ | </ | ||
+ | |||
+ | ==== helm repository登録 ==== | ||
+ | |||
+ | < | ||
+ | helm repo add linstor https:// | ||
+ | # helm repo list | ||
+ | NAME URL | ||
+ | linstor https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== linstor-opインストール ==== | ||
+ | |||
+ | < | ||
+ | helm install linstor-op linstor/ | ||
+ | --set operator.controller.enabled=false \ | ||
+ | --set etcd.persistentVolume.enabled=false \ | ||
+ | --set operator.etcd.enabled=false \ | ||
+ | --set controllerEndpoint=http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== 確認 ==== | ||
+ | |||
+ | ちゃんとpodが起動してればOK | ||
+ | < | ||
+ | # kubectl get pod | ||
+ | NAME | ||
+ | alpine-test | ||
+ | linstor-op-csi-controller-76d5bcfcb9-z2mrw | ||
+ | linstor-op-csi-node-54wf6 | ||
+ | linstor-op-csi-node-9fcn9 | ||
+ | linstor-op-csi-node-rw4h5 | ||
+ | linstor-op-etcd-0 | ||
+ | linstor-op-ha-controller-6f9784f965-bqqcp | ||
+ | linstor-op-ns-node-74zjb | ||
+ | linstor-op-ns-node-ldc5q | ||
+ | linstor-op-ns-node-m7hcm | ||
+ | linstor-op-operator-7b9b9b685d-mnc8z | ||
+ | ubuntu | ||
+ | ubuntu-7c969d5f7d-lq96g | ||
+ | </ | ||
+ | |||
+ | ==== StorageClass作成 ==== | ||
+ | |||
+ | Kubernetes から利用する為に、StorageClass作成 | ||
+ | |||
+ | < | ||
+ | apiVersion: storage.k8s.io/ | ||
+ | kind: StorageClass | ||
+ | metadata: | ||
+ | # The name used to identify this StorageClass. | ||
+ | name: linstor-basic-storage-class | ||
+ | # The name used to match this StorageClass with a provisioner. | ||
+ | # linstor.csi.linbit.com is the name that the LINSTOR CSI plug-in uses to identify itself | ||
+ | provisioner: | ||
+ | volumeBindingMode: | ||
+ | parameters: | ||
+ | # LINSTOR will provision volumes from the drbdpool storage pool configured | ||
+ | # On the satellite nodes in the LINSTOR cluster specified in the plug-in' | ||
+ | storagePool: | ||
+ | resourceGroup: | ||
+ | # Setting a fstype is required for " | ||
+ | # Currently supported: xfs/ext4 | ||
+ | csi.storage.k8s.io/ | ||
+ | linstor.csi.linbit.com/ | ||
+ | </ | ||
+ | |||
+ | ==== PVC作成 ==== | ||
+ | |||
+ | < | ||
+ | kind: PersistentVolumeClaim | ||
+ | apiVersion: v1 | ||
+ | metadata: | ||
+ | name: linstor-volume-01 | ||
+ | spec: | ||
+ | storageClassName: | ||
+ | accessModes: | ||
+ | - ReadWriteOnce | ||
+ | resources: | ||
+ | requests: | ||
+ | storage: 3Gi | ||
+ | </ | ||
+ | |||
+ | |||
+ | === PVC作成した時点 === | ||
+ | |||
+ | PVC作成した時点ではまだPVは作成してない。 | ||
+ | |||
+ | < | ||
+ | # kubectl apply -f pvc.yaml | ||
+ | persistentvolumeclaim/ | ||
+ | |||
+ | # kubectl get pvc | ||
+ | NAME STATUS | ||
+ | linstor-volume-01 | ||
+ | |||
+ | # kubectl get pv | ||
+ | No resources found | ||
+ | |||
+ | # linstor volume list -p | ||
+ | +------------------------------------------------------------------------------------------+ | ||
+ | | Node | Resource | StoragePool | VolNr | MinorNr | DeviceName | Allocated | InUse | State | | ||
+ | |==========================================================================================| | ||
+ | +------------------------------------------------------------------------------------------+ | ||
+ | </ | ||
+ | ==== PodからPV利用 ==== | ||
+ | |||
+ | < | ||
+ | apiVersion: v1 | ||
+ | kind: Pod | ||
+ | metadata: | ||
+ | name: ubuntu | ||
+ | spec: | ||
+ | containers: | ||
+ | - image: ubuntu | ||
+ | name: ubuntu | ||
+ | command: [ "/ | ||
+ | args: [ "while true; do sleep 30; done;" ] | ||
+ | volumeMounts: | ||
+ | - name: linstor-volume | ||
+ | mountPath: /data | ||
+ | ports: | ||
+ | - containerPort: | ||
+ | volumes: | ||
+ | - name: linstor-volume | ||
+ | persistentVolumeClaim: | ||
+ | claimName: " | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Pod作成すると、PVも作成される === | ||
+ | |||
+ | < | ||
+ | kubectl apply -f ubutnu.yaml | ||
+ | |||
+ | # kubectl get pv | ||
+ | NAME | ||
+ | pvc-c83e52e0-f8c7-447c-a3f2-8f01daaeb4c2 | ||
+ | |||
+ | # kubectl get pvc | ||
+ | NAME STATUS | ||
+ | linstor-volume-01 | ||
+ | |||
+ | # linstor volume list -p | ||
+ | +--------------------------------------------------------------------------------------------------------------------------------------------+ | ||
+ | | Node | Resource | ||
+ | |============================================================================================================================================| | ||
+ | | linstor-node04 | pvc-c83e52e0-f8c7-447c-a3f2-8f01daaeb4c2 | linstor-pool | 0 | 1000 | / | ||
+ | | linstor-node05 | pvc-c83e52e0-f8c7-447c-a3f2-8f01daaeb4c2 | linstor-pool | 0 | 1000 | / | ||
+ | | linstor-node06 | pvc-c83e52e0-f8c7-447c-a3f2-8f01daaeb4c2 | linstor-pool | 0 | 1000 | / | ||
+ | +--------------------------------------------------------------------------------------------------------------------------------------------+ | ||
+ | </ | ||
+ | |||
+ | |||
+ | === PVC削除 === | ||
+ | |||
+ | PVCを削除すると、ちゃんとlinstorで削除されている。 | ||
+ | |||
+ | < | ||
+ | # kubectl delete pod ubuntu | ||
+ | pod " | ||
+ | |||
+ | # kubectl get pvc | ||
+ | NAME STATUS | ||
+ | linstor-volume-01 | ||
+ | |||
+ | # kubectl delete pvc linstor-volume-01 | ||
+ | persistentvolumeclaim " | ||
+ | |||
+ | # linstor volume list -p | ||
+ | +------------------------------------------------------------------------------------------+ | ||
+ | | Node | Resource | StoragePool | VolNr | MinorNr | DeviceName | Allocated | InUse | State | | ||
+ | |==========================================================================================| | ||
+ | +------------------------------------------------------------------------------------------+ | ||
+ | </ | ||
+ | |||
{{tag> | {{tag> |