๐Longhorn ๊ฐ์
Longhorn์ Kubernetes ํ๊ฒฝ์์ ํด๋ผ์ฐ๋ ๋ค์ดํฐ๋ธ ๋ถ์ฐ ๋ธ๋ก ์คํ ๋ฆฌ์ง๋ฅผ ์ ๊ณตํ๋ ์คํ์์ค ํ๋ก์ ํธ์ด๋ค. Kubernetes ํด๋ฌ์คํฐ์์ ์ฌ์ฉํ ์ ์๋ ๊ฐ๋ณ๊ณ , ๊ณ ๊ฐ์ฉ์ฑ์ ๋ธ๋ก ์คํ ๋ฆฌ์ง ์์คํ ์ผ๋ก ์๊ตฌ์ ์ธ ์ ์ฅ ๊ณต๊ฐ(Persistent Volume)์ ์ ๊ณตํ์ฌ Pod ์ฌ์์, ๋ ธ๋ ์ฅ์ ์์๋ ๋ฐ์ดํฐ๊ฐ ์ ์ง๋๊ฒ ํด์ค๋ค.
| ๊ธฐ๋ฅ | ์ค๋ช |
|---|---|
| ๋ถ์ฐ ๋ณต์ | ๊ธฐ๋ณธ์ ์ผ๋ก 2~3๊ฐ์ ๋ณต์ ๋ณธ์ ์์ฑํ์ฌ ๋ฐ์ดํฐ ์ ์ค ๋ฐฉ์ง |
| UI ์ ๊ณต | ์น ๊ธฐ๋ฐ ๋์๋ณด๋ ์ ๊ณต (๋ณผ๋ฅจ ์ํ, ๋ณต์ , ๋ฐฑ์ ๊ด๋ฆฌ) |
| ์ค๋ ์ท/๋ฐฑ์ | ๋ณผ๋ฅจ ์ค๋ ์ท ๋ฐ ๋ฐฑ์ ๊ธฐ๋ฅ ๋ด์ฅ (S3/NFS ๋ฐฑ์ ์ง์) |
| CSI ์ง์ | Kubernetes CSI (Container Storage Interface) ์ฐ๋ |
| ์คํ ๋ฆฌ์ปค๋ฒ๋ฆฌ | ๋ ธ๋ ์ฅ์ ์ ๋ณต์ ๋ณธ ์๋ ์ฌ๋ฐฐ์น |
| ๊ฒฝ๋ํ | ๋ค๋ฅธ ๋ถ์ฐ ์คํ ๋ฆฌ์ง์ ๋นํด ์ค์น ๋ฐ ์ด์์ด ๋จ์ |
๐ณ๏ธโ๐ [๊ถ๊ธํ์ ]
๐[๋ชฉ์ฐจ]
๋ ๋์คํฌ์ ๊ฐ๊ฐ 5GB ๋จ์ ์๋ ๊ฒฝ์ฐ, CSI๊ฐ ์ด๋ฅผ ํฉ์ณ์ 10GB ๋ณผ๋ฅจ์ ๋ง๋ค ์ ์๋์ง๋ ํด๋น CSI ๋๋ผ์ด๋ฒ์ ๋ฐฑ์๋ ์คํ ๋ฆฌ์ง์ ๋ฅ๋ ฅ์ ๋ฐ๋ผ ๋ค๋ฅด๋ค.
| CSI ๋๋ผ์ด๋ฒ | ๋์คํฌ ํฉ์นจ ๊ฐ๋ฅ ์ฌ๋ถ | ์ค๋ช |
|---|---|---|
| Longhorn | ๊ฐ๋ฅ | ์ฌ๋ฌ ๋ ธ๋ ๋์คํฌ๋ฅผ ๋ฌถ์ด ๋ณผ๋ฅจ ๊ตฌ์ฑ |
| Ceph RBD | ๊ฐ๋ฅ | ๋ฐฑ์๋์ OSD ์ฌ๋ฌ ๊ฐ โ ํ ๊ตฌ์ฑ |
| LVM-CSI | ๊ฐ๋ฅ | Physical Volume ๋ฌถ์ด์ Logical Volume ์์ฑ |
| Local Path CSI | ๋ถ๊ฐ | ๋จ์ผ ๋ ธ๋, ๋จ์ผ ๊ฒฝ๋ก์์๋ง ํ ๋น |
| HostPath | ๋ถ๊ฐ | ํ ์คํธ ์ ์ฉ, ๋์คํฌ ํฉ์นจ ๊ธฐ๋ฅ ์์ |
MinIO์ฒ๋ผ ๋์คํฌ I/O๊ฐ ๋ง์ S3 ์ํฌ๋ก๋์๋ hostPath ์ฑ๋ฅ์ด ์ข๊ธด ํ์ง๋ง, ์ด์ ๋ณต์ก๋์ ์ฅ์ ๋ด๊ตฌ์ฑ์ ๊ณ ๋ คํด Longhorn ๊ฐ์ CSI ๋ฐฉ์์ ๋ง์ด ์ด๋ค.
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
hostPath:
path: /mnt/minio1
| ํญ๋ชฉ | hostPath ์ฌ์ฉ | CSI ๋๋ผ์ด๋ฒ (์: Longhorn, local-static-provisioner) |
|---|---|---|
| ๊ฐ๋ | Pod์์ ๋ ธ๋ ๋๋ ํ ๋ฆฌ๋ฅผ ์ง์ ๋ง์ดํธ | ์ฟ ๋ฒ๋คํฐ์ค ํ์ค ์คํ ๋ฆฌ์ง ์ธํฐํ์ด์ค๋ฅผ ํตํด ๋์คํฌ ์ฌ์ฉ |
| ์คํ ๋ฆฌ์ง ํด๋์ค ์ฌ์ฉ ๊ฐ๋ฅ ์ฌ๋ถ | ๋ถ๊ฐ | ๊ฐ๋ฅ (storageClassName ์ง์ ๊ฐ๋ฅ) |
| ๋์ ํ๋ก๋น์ ๋ | ๋ถ๊ฐ๋ฅ (์๋ YAML ํ์) | ๊ฐ๋ฅ (Longhorn ๋ฑ์ ๋์ PVC ์์ฑ ์ง์) |
| ๋ฐ์ดํฐ ๊ฐ์ฉ์ฑ | ๋์คํฌ๊ฐ ๋ถ์ ๋ ธ๋์๋ง ์กด์ฌ (๋ ธ๋ ์ฅ์ ์ ์์ค ๊ฐ๋ฅ) | Replica, Snapshot, Self-healing ๋ฑ์ผ๋ก ๋ด๊ตฌ์ฑโ |
| Pod ์ด๋ ๊ฐ๋ฅ์ฑ | ํด๋น ๋ ธ๋์๋ง ์คํ ๊ฐ๋ฅ (AntiAffinity ํ์) | Replica ๊ธฐ๋ฐ์ด๊ฑฐ๋ volumeAttachment๋ก ์ค์ผ์ค ์ ์ฐ์ฑโ |
| ๋ฐฑ์ /๋ณต์ ๊ธฐ๋ฅ | ์์ (์ง์ ๊ด๋ฆฌํด์ผ ํจ) | ๋๋ถ๋ถ CSI๋ ์์ฒด ๋ฐฑ์ /์ค๋ ์ท API ์ ๊ณต (Longhorn UI ํฌํจ) |
| ์ด์ ๊ด๋ฆฌ UI | ์์ | ์์ (Longhorn, OpenEBS ๋ฑ์ ๋์๋ณด๋ ์ ๊ณต) |
| ์ฑ๋ฅ | ๊ฐ์ฅ ๋น ๋ฆ (๋์คํฌ ์ง์ ์ฐ๊ฒฐ) | ์ฝ๊ฐ ๋๋ฆด ์ ์์ (๋คํธ์ํฌ ๋ณต์ overhead) |
| ์ญํ | ์ค๋ช |
|---|---|
| MinIO | ๊ณ ์ฑ๋ฅ ๋ถ์ฐ ์ค๋ธ์ ํธ ์ ์ฅ์ (S3 compatible) |
| Longhorn | ์ฟ ๋ฒ๋คํฐ์ค ๋ค์ดํฐ๋ธ ๋ถ์ฐ ๋ธ๋ก ์คํ ๋ฆฌ์ง ์๋ฃจ์ |
volumeClaimTemplates:
- metadata:
name: data
spec:
storageClassName: longhorn
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 100Gi
์ด๋ ๊ฒ ํ๋ฉด Longhorn์ด ์๋์ผ๋ก ๋ณผ๋ฅจ์ ์์ฑํ๊ณ , MinIO๊ฐ ๊ทธ ์์ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๊ฒ ๋๋ค.
์คํ ๋ฆฌ์ง ๊ณ ๊ฐ์ฉ์ฑ
PVC ๊ด๋ฆฌ ๊ฐํธ
์คํ ๋ฆฌ์ง UI ๋ฐ ๋ฐฑ์
| ํญ๋ชฉ | ์ค๋ช |
|---|---|
| ์ฑ๋ฅ | Longhorn์ ๋ถ์ฐ ์คํ ๋ฆฌ์ง์ด๋ฏ๋ก ๋์คํฌ + ๋คํธ์ํฌ I/O๊ฐ ๊ฒฐํฉ๋จ. ๊ณ ์ฑ๋ฅ MinIO ๊ตฌ์ฑ์์ ๋ก์ปฌ ๋์คํฌ๊ฐ ๋ ๋น ๋ฆ |
| ๋ ์ดํด์ | S3 ์ํฌ๋ก๋์์ ๋๊ท๋ชจ ๋ณ๋ ฌ ์์ฒญ์ด ๋ง์ผ๋ฉด, Longhorn latency๊ฐ ์ํฅ ์ค ์ ์์ |
| ์ค๋ณต ๊ด๋ฆฌ | MinIO ์์ฒด๊ฐ erasure coding/replica๋ฅผ ํ๋ฏ๋ก, Longhorn๊ณผ ์ค๋ณต๋ ๋ด๊ตฌ์ฑ ๊ด๋ฆฌ ๊ฐ๋ฅ์ฑ ์กด์ฌ (์ฃผ์ํด์ ์ค์ ํ์) |
helm repo add longhorn https://charts.longhorn.io
helm repo update
kubectl create namespace longhorn-system
helm install longhorn longhorn/longhorn \
--namespace longhorn-system \
--set defaultSettings.defaultReplicaCount=2 \
--set defaultSettings.recreateFailedPod=true
kubectl -n longhorn-system patch -p '{"value": "true"}' --type=merge lhs deleting-confirmation-flag
helm uninstall longhorn -n longhorn-system
kubectl delete namespace longhorn-system
vagrant@master:~$ k get po -n longhorn-system -w
NAME READY STATUS RESTARTS AGE
csi-attacher-647d7767b9-6kf65 1/1 Running 0 26s
csi-attacher-647d7767b9-7xxdb 1/1 Running 0 26s
csi-attacher-647d7767b9-hbjz5 1/1 Running 0 26s
csi-provisioner-76bc4b5886-4pkvl 1/1 Running 0 26s
csi-provisioner-76bc4b5886-jrccb 1/1 Running 0 26s
csi-provisioner-76bc4b5886-rzc9z 1/1 Running 0 26s
csi-resizer-78cd7545b7-5bplx 1/1 Running 0 25s
csi-resizer-78cd7545b7-m6mt2 1/1 Running 0 25s
csi-resizer-78cd7545b7-md299 1/1 Running 0 25s
csi-snapshotter-7b7db78f9-j4q7f 1/1 Running 0 25s
csi-snapshotter-7b7db78f9-pdr92 1/1 Running 0 25s
csi-snapshotter-7b7db78f9-t8cc6 1/1 Running 0 25s
engine-image-ei-db6c2b6f-2krkx 1/1 Running 0 74s
engine-image-ei-db6c2b6f-7lmcc 1/1 Running 0 74s
engine-image-ei-db6c2b6f-gb725 1/1 Running 0 74s
instance-manager-3ea5b7589af1189d2443a9741d58a959 1/1 Running 0 40s
instance-manager-4fbef9fc9af28ebef2cc1437097b6d51 1/1 Running 0 43s
instance-manager-d883d45a264cebf998825ad3072d756e 1/1 Running 0 44s
longhorn-csi-plugin-q72pw 3/3 Running 0 25s
longhorn-csi-plugin-qffqz 3/3 Running 0 25s
longhorn-csi-plugin-w5d65 3/3 Running 0 25s
longhorn-driver-deployer-85c5f4ff6f-wf62g 1/1 Running 0 82s
longhorn-manager-8d4cm 2/2 Running 0 82s
longhorn-manager-cl8s4 2/2 Running 0 82s
longhorn-manager-thxqs 2/2 Running 0 83s
longhorn-ui-5984465c7b-jx8vt 1/1 Running 0 83s
longhorn-ui-5984465c7b-wcpdt 1/1 Running 0 82s
vagrant@master:~$ k get svc -n longhorn-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
longhorn-admission-webhook ClusterIP 10.233.8.248 <none> 9502/TCP 4m37s
longhorn-backend ClusterIP 10.233.28.119 <none> 9500/TCP 4m37s
longhorn-conversion-webhook ClusterIP 10.233.62.195 <none> 9501/TCP 4m37s
longhorn-frontend ClusterIP 10.233.11.227 <none> 80/TCP 4m37s
longhorn-recovery-backend ClusterIP 10.233.59.91 <none> 9503/TCP 4m37s
vagrant@master:~$ k get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
longhorn (default) driver.longhorn.io Delete Immediate true 5m50s
longhorn-static driver.longhorn.io Delete Immediate true 14m
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: longhorn-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 5Gi
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mypod
image: busybox
command: ["/bin/sh"]
args: ["-c", "sleep 3600"]
volumeMounts:
- mountPath: "/data"
name: myvol
volumes:
- name: myvol
persistentVolumeClaim:
claimName: longhorn-pvc
/data ์ ๋ณผ๋ฅจ์ด ๋ง์ดํธ ๋์ด ์๋ค. mypod ์ปจํ ์ด๋์ /data ์ hi.txt ํ์ผ์ ์์ฑํ ํ mypod๋ฅผ ์ญ์ ํ๋ค. ์๋ก์ด pod ๋ฅผ ์์ฑํ์ฌ /data ์ ์ ๊ทผํ๋ฉด ์ข ์ ์ ์์ฑํ hi.txt ํ์ผ์ด ๋จ์ ์๋ค.
vagrant@master:~$ k exec -it mypod -- sh
/ # cd /data
/data # echo "hi" > hi.txt
/data # cat hi.txt
hi
/data # exit
vagrant@master:~$ k delete po mypod
pod "mypod" deleted
vagrant@master:~$ k apply -f mypod.yml
pod/mypod created
vagrant@master:~$ k exec -it mypod -- sh
/ # ls /data
hi.txt lost+found
์ค๋ธ์ ํธ ์คํ ๋ฆฌ์ง(Object Storage) ๋ ํ์ผ์์คํ ์ ์ง์ ํฌ๋งทํ๊ฑฐ๋ ๋ณ๊ฒฝํ๋ ๊ฒ ์๋๊ณ , MinIO ๊ฐ์ ์ ํ๋ฆฌ์ผ์ด์ (์ํํธ์จ์ด) ์ด ๊ธฐ์กด ๋์คํฌ ์์์ ์ค๋ธ์ ํธ ์ ์ฅ ๋ฐฉ์์ ๊ตฌํํ๋ ๊ฐ๋ ์ด๋ค.
| ํญ๋ชฉ | ์ค๋ช |
|---|---|
| ํ์ผ์์คํ ํฌ๋งท ํ์ ์ฌ๋ถ | ๋ถ๊ฐ. ์ผ๋ฐ์ ์ธ ext4, xfs ๊ฐ์ ํ์ผ์์คํ ์์์ ์๋ |
| MinIO ์ค์น๋ง์ผ๋ก ๊ฐ๋ฅ ์ฌ๋ถ | ๊ฐ๋ฅ. MinIO๊ฐ ์ค๋ธ์ ํธ ์คํ ๋ฆฌ์ง๋ฅผ ์ํํธ์จ์ด์ ์ผ๋ก ์ ๊ณต |
| OS ์ธ์ ๋ฐฉ์ | OS๋ ๋จ์ํ "๋๋ ํ ๋ฆฌ+ํ์ผ"๋ก ๋ณด์ง๋ง, MinIO๋ ๊ทธ๊ฒ์ ์ค๋ธ์ ํธ์ฒ๋ผ ๊ด๋ฆฌ |
| ํ๋์จ์ด์์ ๊ด๊ณ | ๋ก์ปฌ ๋์คํฌ, SAN, ํน์ PVC(์ฟ ๋ฒ๋คํฐ์ค) ๋ฑ ์ด๋ค ์ ์ฅ์๋ ์์์ ์คํ ๊ฐ๋ฅ |
MinIO ์์
- ๋์คํฌ๋ฅผ ext4๋ก ํฌ๋งทํ๊ณ /mnt/data1์ ๋ง์ดํธ
- MinIO ์ค์นํ๊ณ /mnt/data1์ ๋ฐ์ดํฐ ๋๋ ํ ๋ฆฌ๋ก ์ง์
- MinIO๋ /mnt/data1์ ์ค์ ํ์ผ์ ์ ์ฅํ์ง๋ง, ํด๋ผ์ด์ธํธ์๋ S3 API๋ฅผ ํตํด ์ค๋ธ์ ํธ์ฒ๋ผ ๋ณด์