このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
06_virtualization:05_container:16_kubernetes_linstor [2022/05/26 21:56] – 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台とも全部インストール | ||
行 307: | 行 307: | ||
</ | </ | ||
+ | |||
+ | ====== 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> |