Infrastructure

Mac Mini M2 Pro와 k3s로 구축하는 물뮤(MoolMeow) 프로젝트 인프라 🚀

안녕하세요! 오늘은 Mac Mini Pro (M2)에서 k3s 쿠버네티스를 활용해 물뮤(MoolMeow) 프로젝트의 인프라를 어떻게 구축할 수 있는지 알아보겠습니다. 제한된 리소스에서도 강력한 마이크로서비스 환경을 구축하는 방법을 함께 살펴봐요! 💻✨

프로젝트 소개 🐱💦

물뮤(MoolMeow)는 수영(Mool, 물)과 고양이(Meow, 야옹)를 주제로 한 통합 온라인 커뮤니티 서비스입니다. 하나의 도메인 아래 두 가지 컨셉의 커뮤니티를 운영합니다. 이 서비스를 Mac Mini Pro (M2, 16GB RAM)에서 k3s 쿠버네티스 클러스터로 운영할 계획입니다.

인프라 구성 요소 🛠️

하드웨어 사양

  • Mac Mini Pro (M2, 16GB RAM, 512GB SSD) 🖥️
  • 미크로틱 라우터(hAP ac3) 🌐

기본 인프라

  • k3s: 경량 쿠버네티스 배포판 ⛵
  • Vagrant + VMware: 개발 및 테스트 환경 구성 🧪

필수 설치 서비스

1. 네트워크 및 보안 🔒

  • Calico: 네트워크 정책 관리
  • cert-manager: TLS 인증서 자동화
  • Vault: 보안 비밀 관리

2. CI/CD 파이프라인 🔄

  • Jenkins: 지속적 통합(CI)
  • ArgoCD: 지속적 배포(CD) 및 GitOps
  • Harbor: 컨테이너 이미지 레지스트리

3. 모니터링 및 로깅 📊

  • Prometheus + Grafana: 시스템 모니터링 및 시각화
  • Loki + Promtail: 경량 로그 수집 및 저장

4. 서비스 메시 🕸️

  • Istio: 서비스 간 통신 관리 및 모니터링

5. Mac Mini 직접 설치 (쿠버네티스 외부) 📦

  • MySQL: 애플리케이션 데이터베이스
  • Redis: 캐싱 및 세션 관리

설치 순서 및 최적화 전략 📝

1. 기본 환경 구성 🏗️

  • MySQL, Redis 설치 (Mac Mini에 직접 설치)
  • k3s 설치 및 기본 구성
  • Calico 네트워크 플러그인 설정

2. 필수 인프라 구축 🔧

  • cert-manager 설치
  • Vault 설정
  • Harbor 레지스트리 구축

3. CI/CD 파이프라인 🚚

  • Jenkins 배포 및 파이프라인 구성
  • ArgoCD 설치 및 GitOps 저장소 연결

4. 모니터링 시스템 📈

  • Prometheus, Grafana 설치
  • Loki, Promtail 설정

5. 추가 서비스 🌟

  • Istio 서비스 메시 구성 (리소스 허용 시)

리소스 관리 전략 ⚙️

Mac Mini Pro의 제한된 리소스(16GB RAM)에서 최적의 성능을 얻기 위한 몇 가지 전략:

  1. 리소스 제한 설정 🎛️

    • 모든 워크로드에 메모리/CPU 제한 설정
    • 중요 서비스에 우선순위 부여
  2. 경량 구성 사용 🪶

    • Istio 경량 프로필 적용
    • Prometheus 스토리지 보존 기간 조정
  3. 단계적 배포 🪜

    • 한 번에 모든 서비스를 설치하지 않고 필수적인 것부터 시작
    • 안정화 후 추가 서비스 도입

왜 EFK 대신 PLG 스택을 선택했나요? 🤔

전통적인 EFK(Elasticsearch, Fluentd, Kibana) 스택 대신 PLG(Prometheus, Loki, Grafana + Promtail) 스택을 선택한 이유:

  • 낮은 리소스 요구사항 💪

    • Elasticsearch는 메모리 소비가 큰 반면, Loki는 훨씬 가벼움
    • Mac Mini의 제한된 리소스에 더 적합
  • 쿠버네티스 친화성

    • Prometheus와 동일한 레이블 기반 모델 사용
    • 쿠버네티스 환경에 최적화된 통합
  • 운영 간소화 🧩

    • Grafana로 메트릭과 로그를 단일 대시보드에서 확인
    • 관리 오버헤드 감소

데이터베이스를 쿠버네티스 외부에 두는 이유 💾

MySQL과 Redis를 Mac Mini에 직접 설치하는 이유:

  1. 안정성 향상 🛡️

    • 쿠버네티스 클러스터 문제 발생 시에도 데이터베이스는 안정적으로 운영
    • PersistentVolume 관리 복잡성 제거
  2. 리소스 효율성 🔋

    • 컨테이너 오버헤드 없이 하드웨어 직접 액세스
    • 쿠버네티스 클러스터에 더 많은 리소스 확보
  3. 성능 향상

    • 네트워크 레이어 감소로 지연 시간 단축
    • 컨테이너화된 데이터베이스보다 더 나은 I/O 성능

결론 🎯

Mac Mini Pro (M2)와 k3s를 활용한 물뮤(MoolMeow) 프로젝트의 인프라 구성은 제한된 리소스에서도 강력한 클라우드 네이티브 환경을 구축할 수 있음을 보여줍니다. 리소스 관리, 서비스 우선순위 지정, 그리고 경량 대안 선택을 통해 효율적이고 안정적인 시스템을 운영할 수 있습니다.

이 구성은 소규모 프로젝트나 스타트업에게 경제적이면서도 현대적인 인프라 옵션을 제공합니다. 만약 서비스가 확장되면 언제든지 더 큰 인프라로 마이그레이션할 수 있는 기반이 될 것입니다.

앞으로 물뮤 프로젝트가 성장하면서 어떻게 인프라가 발전하는지도 지속적으로 공유하겠습니다! 🚀

질문이나 의견은 댓글로 남겨주세요! 💬

Building MoolMeow Project Infrastructure with Mac Mini M2 Pro and k3s 🚀

Hello there! Today we’re going to explore how to build infrastructure for the MoolMeow project using k3s Kubernetes on a Mac Mini Pro (M2). Let’s discover how to create a powerful microservices environment even with limited resources! 💻✨

Project Introduction 🐱💦

MoolMeow is an integrated online community service focused on swimming (Mool, 물) and cats (Meow, 야옹). It operates two concept communities under a single domain. We plan to run this service on a k3s Kubernetes cluster hosted on a Mac Mini Pro (M2, 16GB RAM).

Infrastructure Components 🛠️

Hardware Specifications

  • Mac Mini Pro (M2, 16GB RAM, 512GB SSD) 🖥️
  • MikroTik Router (hAP ac3) 🌐

Base Infrastructure

  • k3s: Lightweight Kubernetes distribution ⛵
  • Vagrant + VMware: Development and test environment setup 🧪

Essential Services

1. Networking and Security 🔒

  • Calico: Network policy management
  • cert-manager: TLS certificate automation
  • Vault: Secure secret management

2. CI/CD Pipeline 🔄

  • Jenkins: Continuous Integration (CI)
  • ArgoCD: Continuous Deployment (CD) and GitOps
  • Harbor: Container image registry

3. Monitoring and Logging 📊

  • Prometheus + Grafana: System monitoring and visualization
  • Loki + Promtail: Lightweight log collection and storage

4. Service Mesh 🕸️

  • Istio: Service communication management and monitoring

5. Direct Installation on Mac Mini (Outside Kubernetes) 📦

  • MySQL: Application database
  • Redis: Caching and session management

Installation Order and Optimization Strategy 📝

1. Basic Environment Setup 🏗️

  • Install MySQL and Redis directly on Mac Mini
  • Install k3s and configure basics
  • Set up Calico network plugin

2. Essential Infrastructure 🔧

  • Install cert-manager
  • Configure Vault
  • Build Harbor registry

3. CI/CD Pipeline 🚚

  • Deploy Jenkins and set up pipelines
  • Install ArgoCD and connect to GitOps repository

4. Monitoring System 📈

  • Install Prometheus and Grafana
  • Configure Loki and Promtail

5. Additional Services 🌟

  • Set up Istio service mesh (if resources permit)

Resource Management Strategy ⚙️

Some strategies to get optimal performance from the limited resources (16GB RAM) of the Mac Mini Pro:

  1. Set Resource Limits 🎛️

    • Configure memory/CPU limits for all workloads
    • Prioritize critical services
  2. Use Lightweight Configurations 🪶

    • Apply Istio lightweight profile
    • Adjust Prometheus storage retention period
  3. Staged Deployment 🪜

    • Start with essential services rather than installing everything at once
    • Add more services after stabilization

Why Choose PLG Stack Over EFK? 🤔

Reasons for selecting the PLG (Prometheus, Loki, Grafana + Promtail) stack instead of the traditional EFK (Elasticsearch, Fluentd, Kibana) stack:

  • Lower Resource Requirements 💪

    • Elasticsearch has high memory consumption, while Loki is much lighter
    • More suitable for Mac Mini’s limited resources
  • Kubernetes Compatibility

    • Uses the same label-based model as Prometheus
    • Optimized integration with Kubernetes environments
  • Simplified Operations 🧩

    • View metrics and logs in a single Grafana dashboard
    • Reduced management overhead

Why Keep Databases Outside Kubernetes 💾

Reasons for installing MySQL and Redis directly on the Mac Mini:

  1. Improved Stability 🛡️

    • Databases operate reliably even when Kubernetes cluster issues occur
    • Eliminates complexity of PersistentVolume management
  2. Resource Efficiency 🔋

    • Direct hardware access without container overhead
    • More resources available for the Kubernetes cluster
  3. Performance Improvement

    • Reduced latency with fewer network layers
    • Better I/O performance than containerized databases

Conclusion 🎯

The infrastructure configuration for the MoolMeow project using a Mac Mini Pro (M2) and k3s demonstrates that you can build a powerful cloud-native environment even with limited resources. Through resource management, service prioritization, and choosing lightweight alternatives, you can operate an efficient and stable system.

This setup provides an economical yet modern infrastructure option for small projects or startups. If the service expands, it will serve as a foundation for migration to larger infrastructure.

As the MoolMeow project grows, I’ll continue to share how the infrastructure evolves! 🚀

Feel free to leave any questions or comments below! 💬

답글 남기기