들어가며 👋
안녕하세요! 오늘은 Kubernetes 환경에서 Rook-Ceph을 활용한 분산 스토리지 시스템 구축에 대해 이야기해보려고 합니다. CI/CD 파이프라인과 애플리케이션 데이터를 위한 스토리지 솔루션을 고민하던 중, 단순한 HostPath와 고급 분산 스토리지인 Rook-Ceph 사이에서 많은 고민을 했는데요. 결국 경험과 확장성을 위해 Rook-Ceph을 선택한 이유와 구성 과정에서 배운 점들을 공유하고자 합니다.
Rook-Ceph이란? 🤔
먼저 Rook과 Ceph이 무엇인지 간단히 알아보겠습니다.
Ceph는 오픈소스 분산 스토리지 시스템으로, 다음과 같은 특징이 있습니다:
- 객체, 블록, 파일 시스템 인터페이스를 모두 제공
- 분산 아키텍처로 단일 장애점 없음
- 데이터 복제 및 자가 복구 기능
- 페타바이트 규모로 확장 가능
Rook은 Kubernetes용 스토리지 오케스트레이터로, 다음과 같은 역할을 합니다:
- Ceph 같은 분산 스토리지 시스템을 Kubernetes에 통합
- 스토리지 리소스의 배포, 부트스트랩, 구성, 확장, 업그레이드 자동화
- 자가 관리, 자가 확장, 자가 복구 기능 제공
쉽게 말해, Rook은 복잡한 Ceph 분산 스토리지를 Kubernetes에서 쉽게 사용할 수 있게 해주는 도구입니다. 이를 함께 사용하면 “Rook-Ceph”이라는 강력한 Kubernetes 기반 스토리지 솔루션이 탄생합니다.
HostPath vs Rook-Ceph: 고민의 순간 🤷♂️
스토리지 솔루션을 선택할 때 크게 두 가지 접근 방식을 놓고 고민했습니다:
1. HostPath (또는 Local Path Provisioner)
장점:
- 설정이 간단하고 빠름
- 리소스 사용량이 적음
- 이미 마운트된 호스트 경로를 그대로 사용 가능
단점:
- 단일 노드에만 저장되어 노드 장애 시 데이터 손실 위험
- 스토리지 관리 기능 제한적
- 확장성이 낮음
2. Rook-Ceph
장점:
- 고가용성과 데이터 복제 기능
- 확장성이 뛰어남
- 볼륨 스냅샷, 확장 등 고급 스토리지 기능
- 블록, 파일, 객체 스토리지 모두 지원
단점:
- 설정이 복잡함
- 더 많은 시스템 리소스 필요
- 학습 곡선이 가파름
Rook-Ceph을 선택한 이유 💡
여러 고민 끝에 다음과 같은 이유로 Rook-Ceph을 선택했습니다:
미래 확장성 – 처음에는 작은 규모로 시작하더라도, 서비스가 커지면 스토리지도 함께 확장해야 합니다. Rook-Ceph은 클러스터에 노드를 추가하는 것만으로 스토리지를 쉽게 확장할 수 있습니다.
경험과 학습 – 클라우드 네이티브 환경에서 Rook-Ceph은 중요한 기술입니다. 실무에서 이런 기술을 다뤄본 경험은 매우 가치 있습니다.
다양한 스토리지 인터페이스 – 애플리케이션마다 다른 스토리지 요구사항이 있을 수 있습니다. Rook-Ceph은 블록, 파일, 객체 스토리지를 모두 제공하므로 다양한 사용 사례를 지원할 수 있습니다.
데이터 안정성 – 개발 환경에서도 데이터 손실은 큰 문제가 될 수 있습니다. Rook-Ceph의 데이터 복제 기능은 이러한 위험을 줄여줍니다.
Rook-Ceph 구성 시 고려 사항 ⚙️
Rook-Ceph을 구성할 때 다음과 같은 요소들을 고려해야 합니다:
1. 스토리지 아키텍처 설계
Rook-Ceph 클러스터를 설계할 때는 다음과 같은 구성 요소를 이해해야 합니다:
- Monitor (MON) – 클러스터 상태를 모니터링하는 데몬
- Manager (MGR) – 모니터링 기능, 대시보드 제공
- Object Storage Device (OSD) – 실제 데이터를 저장하는 데몬
- Metadata Server (MDS) – CephFS의 메타데이터 관리
개발 환경에서는 이러한 구성 요소를 경량화하여 설정할 수 있습니다. 예를 들어, MON의 수를 3개에서 1개로 줄이거나, 데이터 복제 계수를 3에서 1로 줄일 수 있습니다.
2. 스토리지 풀과 스토리지 클래스
Kubernetes에서 Rook-Ceph을 사용하기 위해서는 다음과 같은 단계가 필요합니다:
- 스토리지 풀 생성 – Ceph 내에서 데이터를 저장할 논리적인 공간
- 스토리지 클래스 생성 – Kubernetes에서 PVC를 통해 스토리지를 요청할 때 사용
다양한 용도에 맞게 여러 스토리지 풀과 스토리지 클래스를 생성할 수 있습니다. 예를 들어:
- Harbor 컨테이너 레지스트리용 스토리지 풀
- 애플리케이션 사용자 업로드 이미지용 스토리지 풀
- 데이터베이스 백업용 스토리지 풀
각 풀마다 복제 계수, 장애 도메인 등을 다르게 설정할 수 있어 요구사항에 맞게 커스터마이징이 가능합니다.
3. 리소스 요구사항
Rook-Ceph은 상당한 시스템 리소스를 필요로 합니다:
- 각 OSD 데몬당 최소 2GB RAM 권장
- 모니터링과 관리 서비스를 위한 추가 메모리
- CPU 리소스(특히 OSD 데몬이 많을 경우)
- 실제 데이터를 저장할 디스크 공간
개발 환경에서는 이러한 요구사항을 최소화하기 위해 경량화된 구성을 사용할 수 있지만, 그래도 기본적인 리소스 요구사항은 충족해야 합니다.
실제 구현 경험 🛠️
프로젝트에서 Rook-Ceph을 구현하면서 다음과 같은 경험을 했습니다:
첫 번째 도전: 디스크 준비
초기에는 Rook-Ceph이 실제 물리적 디스크나 파티션을 필요로 한다는 점이 도전이었습니다. 가상 환경에서는 다음과 같은 방법을 고려했습니다:
- 추가 가상 디스크 설정
- 루프 디바이스 활용
- 디렉토리 기반 OSD 구성
결국 디렉토리 기반 OSD 구성을 선택했는데, 이는 성능 최적화된 방식은 아니지만 개발 환경에서는 충분했습니다.
두 번째 도전: 리소스 할당
Rook-Ceph의 리소스 요구사항을 충족시키기 위해 개발 환경의 VM 리소스를 조정해야 했습니다. 특히 메모리 할당을 증가시켰고, CPU 제한을 완화했습니다.
세 번째 도전: 용도별 스토리지 분리
CI/CD 파이프라인(Harbor)과 애플리케이션(물뮤) 데이터를 위한 별도의 스토리지 풀을 구성했습니다:
- Harbor 이미지 저장소용 풀
- 물뮤 포스트 이미지용 풀
- 물뮤 마켓 이미지용 풀
각 풀에 대해 별도의 스토리지 클래스를 생성하여 애플리케이션이 적절한 스토리지를 사용할 수 있도록 했습니다.
배운 점과 조언 🎓
Rook-Ceph을 구현하면서 배운 몇 가지 중요한 교훈을 공유합니다:
철저한 계획이 필요합니다 – Rook-Ceph은 복잡한 시스템이므로 구현 전에 아키텍처와 리소스 요구사항을 철저히 계획해야 합니다.
개발 환경에서는 경량화된 구성을 사용하세요 – 프로덕션 수준의 고가용성이 필요하지 않다면, 모니터 수와 복제 계수를 줄여 리소스를 절약할 수 있습니다.
점진적으로 접근하세요 – 한 번에 완벽한 구성을 추구하기보다는, 기본 기능부터 시작하여 점진적으로 확장하는 것이 좋습니다.
문서와 커뮤니티를 활용하세요 – Rook과 Ceph 모두 활발한 커뮤니티와 풍부한 문서를 가지고 있습니다. 문제가 발생하면 이러한 리소스를 활용하세요.
마치며 🎉
Rook-Ceph은 복잡하지만 강력한 스토리지 솔루션입니다. 초기 학습 곡선은 가파르지만, 한 번 설정하면 안정적이고 확장 가능한 스토리지 시스템을 얻을 수 있습니다.
개발 환경이든 프로덕션 환경이든, 데이터는 가장 중요한 자산입니다. Rook-Ceph은 이러한 데이터를 안전하게 보호하면서도 필요에 따라 확장할 수 있는 유연성을 제공합니다.
이 글이 Kubernetes에서 Rook-Ceph을 고려하고 계신 분들께 도움이 되었으면 합니다. 질문이나 의견이 있으시면 언제든지 댓글로 남겨주세요! 😊
다음 글에서는 CI/CD 파이프라인의 첫 번째 구성 요소인 Harbor 컨테이너 레지스트리를 Rook-Ceph 스토리지와 함께 설정하는 방법에 대해 알아보겠습니다. 기대해 주세요!
Introduction 👋
Hello everyone! Today I’d like to share my experience setting up a distributed storage system using Rook-Ceph in a Kubernetes environment. While considering storage solutions for our CI/CD pipeline and application data, I found myself torn between simple HostPath storage and the more advanced Rook-Ceph distributed storage. I eventually chose Rook-Ceph for the experience and scalability it offers, and I want to share what I learned along the way.
What is Rook-Ceph? 🤔
Let’s start with a brief overview of Rook and Ceph:
Ceph is an open-source distributed storage system that offers:
- Object, block, and file system interfaces
- Distributed architecture with no single point of failure
- Data replication and self-healing capabilities
- Scalability to petabyte scale
Rook is a storage orchestrator for Kubernetes that:
- Integrates distributed storage systems like Ceph with Kubernetes
- Automates deployment, bootstrapping, configuration, scaling, and upgrading of storage resources
- Provides self-managing, self-scaling, and self-healing storage services
In simple terms, Rook makes the complex Ceph distributed storage easy to use within Kubernetes. Together, they form “Rook-Ceph,” a powerful Kubernetes-based storage solution.
HostPath vs Rook-Ceph: The Dilemma 🤷♂️
When choosing a storage solution, I considered two main approaches:
1. HostPath (or Local Path Provisioner)
Pros:
- Simple and quick to set up
- Minimal resource usage
- Can use already mounted host paths directly
Cons:
- Data stored on a single node, risking data loss in case of node failure
- Limited storage management features
- Poor scalability
2. Rook-Ceph
Pros:
- High availability and data replication
- Excellent scalability
- Advanced storage features like volume snapshots and expansion
- Supports block, file, and object storage
Cons:
- Complex setup
- Requires more system resources
- Steeper learning curve
Why I Chose Rook-Ceph 💡
After careful consideration, I chose Rook-Ceph for these reasons:
Future Scalability – Even if starting small, as the service grows, storage needs to scale accordingly. Rook-Ceph makes it easy to expand storage by simply adding nodes to the cluster.
Experience and Learning – Rook-Ceph is an important technology in cloud-native environments. Hands-on experience with such technology is invaluable in a professional setting.
Variety of Storage Interfaces – Different applications may have different storage requirements. Rook-Ceph provides block, file, and object storage, supporting a wide range of use cases.
Data Reliability – Data loss can be a significant issue even in development environments. Rook-Ceph’s data replication features reduce this risk.
Considerations for Rook-Ceph Setup ⚙️
When setting up Rook-Ceph, several elements need consideration:
1. Storage Architecture Design
When designing a Rook-Ceph cluster, you need to understand these components:
- Monitor (MON) – Daemons that monitor cluster state
- Manager (MGR) – Provides monitoring features and dashboard
- Object Storage Device (OSD) – Daemons that store actual data
- Metadata Server (MDS) – Manages metadata for CephFS
In development environments, you can configure lightweight versions of these components. For example, reducing the number of MONs from 3 to 1, or reducing the replication factor from 3 to 1.
2. Storage Pools and Storage Classes
To use Rook-Ceph in Kubernetes, you need:
- Create Storage Pools – Logical spaces within Ceph for storing data
- Create Storage Classes – Kubernetes resources used when requesting storage via PVCs
You can create multiple storage pools and storage classes for different purposes. For example:
- A storage pool for Harbor container registry
- A storage pool for application user upload images
- A storage pool for database backups
Each pool can have different replication factors, failure domains, etc., allowing customization to fit specific requirements.
3. Resource Requirements
Rook-Ceph demands significant system resources:
- Minimum 2GB RAM recommended per OSD daemon
- Additional memory for monitoring and management services
- CPU resources (especially with many OSD daemons)
- Disk space for storing actual data
In development environments, you can use a lightweight configuration to minimize these requirements, but you still need to meet the basic resource demands.
Practical Implementation Experience 🛠️
During the implementation of Rook-Ceph in our project, I encountered several challenges:
First Challenge: Disk Preparation
Initially, I found it challenging that Rook-Ceph requires actual physical disks or partitions. In a virtual environment, we considered:
- Setting up additional virtual disks
- Utilizing loop devices
- Configuring directory-based OSDs
We eventually opted for directory-based OSD configuration, which isn’t performance-optimized but was sufficient for our development environment.
Second Challenge: Resource Allocation
To meet Rook-Ceph’s resource requirements, we had to adjust the VM resources in our development environment. We increased memory allocation and relaxed CPU limits.
Third Challenge: Separating Storage for Different Uses
We configured separate storage pools for our CI/CD pipeline (Harbor) and application (Moolmeow) data:
- Pool for Harbor image registry
- Pool for Moolmeow post images
- Pool for Moolmeow market images
We created separate storage classes for each pool to ensure applications use the appropriate storage.
Lessons Learned and Advice 🎓
Here are some key lessons I learned while implementing Rook-Ceph:
Thorough Planning is Essential – Rook-Ceph is a complex system, so plan your architecture and resource requirements thoroughly before implementation.
Use Lightweight Configurations for Development – If you don’t need production-level high availability, reduce the number of monitors and replication factor to save resources.
Take an Incremental Approach – Rather than aiming for a perfect configuration from the start, begin with basic functionality and expand gradually.
Leverage Documentation and Community – Both Rook and Ceph have active communities and extensive documentation. Use these resources when encountering issues.
Conclusion 🎉
Rook-Ceph may be complex, but it’s a powerful storage solution. While the initial learning curve is steep, once configured, it provides a reliable and scalable storage system.
Whether in development or production environments, data is your most valuable asset. Rook-Ceph offers the protection this data deserves while providing the flexibility to scale as needed.
I hope this post helps those considering Rook-Ceph for their Kubernetes environments. If you have any questions or comments, please feel free to leave them below! 😊
In the next post, we’ll explore how to set up Harbor container registry, the first component of our CI/CD pipeline, with Rook-Ceph storage. Stay tuned!