Kubernetes와의 통합
6️⃣ Kubernetes와의 통합
Kubernetes와 Rook-Ceph의 통합은 매우 유연하며, Block(StorageClass + RBD), File(CephFS), Object(RGW + S3) 형태로 구현할 수 있습니다. 이 장에서는 Ceph CSI 드라이버 구조부터 시작해 실제 PVC와 RBD 간의 매핑 구조, 그리고 Snapshot/Clone/Ingress 연동까지 다룹니다.
1. Ceph CSI 드라이버 구조
📌 개요
Kubernetes는 CSI(Container Storage Interface)
를 통해 다양한 스토리지를 통합합니다.
Rook-Ceph은 CSI 기반 드라이버를 내장하고 있어 Ceph의 Block, File, Object 스토리지를 Kubernetes에서 바로 사용할 수 있습니다.
📦 구성요소
graph TD; A[Kubernetes Pod] --> B[PVC]; B --> C[CSI Provisioner]; C --> D[Rook-Ceph Operator]; D --> E[Ceph Mon]; D --> F[Ceph OSD]; F --> G[Disk];
- PVC: 사용자가 요청한 스토리지
- CSI Provisioner: 실제 RBD, CephFS 등의 볼륨을 생성
- Rook-Ceph Operator: CSI Plugin과 Ceph 클러스터 사이 중재
2. StorageClass 구성 (block, cephfs, object)
📘 RBD (Block) StorageClass 예시
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ceph-block
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
clusterID: rook-ceph
pool: replicapool
imageFormat: "2"
imageFeatures: layering
csi.storage.k8s.io/fstype: ext4
reclaimPolicy: Delete
📘 CephFS StorageClass 예시
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ceph-filesystem
provisioner: rook-ceph.cephfs.csi.ceph.com
parameters:
clusterID: rook-ceph
fsName: myfs
pool: myfs-data0
reclaimPolicy: Retain
✅ 두 StorageClass 모두
provisioner
가 Ceph CSI 드라이버와 연결되어야 함
3. PVC와 실제 RBD/FS 매핑 구조
📦 매핑 흐름도
graph LR; A[Pod] --> B[PVC]; B --> C[StorageClass]; C --> D[CSI Controller]; D --> E[Rook-Ceph Operator]; E --> F[RBD or CephFS Volume];
📘 PVC 예시 (RBD)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ceph-block-pvc
spec:
storageClassName: ceph-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
- 이 PVC가 생성되면
CSI Controller
가 Ceph에 요청해 RBD 이미지 생성 → OSD에 매핑 → Pod에 마운트
4. Volume Expansion, Snapshot, Clone 실습
📌 Volume Expansion
PVC를 allowVolumeExpansion: true
로 설정하면 동적 크기 변경이 가능합니다.
# StorageClass에 allowVolumeExpansion 설정
allowVolumeExpansion: true
PVC를 아래처럼 Patch합니다:
kubectl patch pvc ceph-block-pvc -p '{"spec": {"resources": {"requests": {"storage": "10Gi"}}}}'
📸 Snapshot 예시
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: ceph-block-snap
spec:
volumeSnapshotClassName: csi-rbdplugin-snapclass
source:
persistentVolumeClaimName: ceph-block-pvc
🧬 Clone 예시
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ceph-block-clone
spec:
dataSource:
name: ceph-block-snap
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
storageClassName: ceph-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
5. Ceph Object Gateway + Ingress 연동 (TLS 포함)
📌 RGW란?
Ceph는 **S3 호환 Object Gateway(RGW)**를 제공합니다.
Ingress를 통해 Kubernetes 클러스터 외부에서 접근 가능합니다.
🏗️ 예시 구조도
graph LR; A[External Client (S3)] --> B[Ingress TLS]; B --> C[Service: rook-ceph-rgw-my-store]; C --> D[Ceph RGW Pod]; D --> E[OSD (Object Pool)];
📘 Ingress 구성 예시
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ceph-object-ingress
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
tls:
- hosts:
- s3.example.com
secretName: tls-secret
rules:
- host: s3.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: rook-ceph-rgw-my-store
port:
number: 80
- 실제로는
tls-secret
을 cert-manager로 자동 발급받을 수도 있음
✅ 마무리 요약
항목 | 설명 |
---|---|
CSI 구조 | Kubernetes와 Ceph 연결의 핵심 컴포넌트 |
StorageClass | RBD, CephFS, Object 각각에 대한 정의 필요 |
PVC → Volume 매핑 | CSI → Operator → Ceph 내부 자원으로 매핑됨 |
Snapshot / Clone / 확장 | 동적 지원 가능하며 Rook-Ceph는 기본 기능으로 제공 |
RGW + Ingress 연동 | 외부에서 TLS로 S3 접근 가능 |
마지막 수정일자