Velero
Velero는 Kubernetes 클러스터의 백업, 복원, 재해 복구를 위한 오픈소스 도구입니다. Lumie 인프라에서 클러스터 리소스와 PVC 데이터를 MinIO에 백업합니다.
참고: PostgreSQL 데이터베이스 백업(WAL 아카이브 + 베이스백업)은 Velero가 아닌 CloudNativePG Barman이 직접 Cloudflare R2에 수행합니다. Velero의 주된 역할은 Kubernetes 리소스 메타데이터 및 비데이터베이스 PVC 백업입니다.
개요
주요 기능
| 기능 | 설명 |
|---|---|
| 클러스터 백업 | Kubernetes 리소스 백업 |
| PVC 백업 | 파일시스템 레벨 볼륨 백업 |
| 재해 복구 | 클러스터 전체 복원 |
| 스케줄 백업 | 자동화된 정기 백업 |
| 선택적 복원 | 네임스페이스/리소스별 복원 |
아키텍처
설치 및 구성
Helm 차트 설정
# Velero Server 설정
upgradeCRDs: false # CRD 업그레이드 작업 건너뛰기 (kubectl 이미지 종속성 방지)
image:
repository: zot.lumie-infra.com/velero/velero
tag: v1.17.2
pullPolicy: IfNotPresent
replicaCount: 1
resources:
requests:
cpu: 11m
memory: 140Mi
limits:
memory: 140Mi
# CPU 제한 없음 (안정성 우선)
AWS 플러그인 설정
initContainers:
- name: velero-plugin-for-aws
image: zot.lumie-infra.com/velero/velero-plugin-for-aws:v1.14.0
volumeMounts:
- mountPath: /target
name: plugins
MinIO는 S3 호환 API를 제공하므로 AWS 플러그인을 사용합니다.
Node Agent 설정
deployNodeAgent: true
nodeAgent:
podVolumePath: /var/lib/kubelet/pods
privileged: false # 특권 모드 비활성화 (보안 강화)
resources:
requests:
cpu: 15m
memory: 100Mi
limits:
memory: 100Mi
Node Agent는 각 노드에서 실행되어 PVC의 파일시스템 백업을 담당합니다.
백업 스토리지 설정
BackupStorageLocation
configuration:
backupStorageLocation:
- name: default
provider: aws
bucket: velero-backups
config:
region: minio
s3ForcePathStyle: "true"
s3Url: http://minio.minio.svc.cluster.local:9000
VolumeSnapshotLocation
configuration:
volumeSnapshotLocation:
- name: default
provider: aws
config:
region: minio
자격 증명 설정
credentials:
useSecret: true
existingSecret: velero-s3-credentials
자격 증명은 Vault Static Secret을 통해 관리됩니다:
# Vault Static Secret 설정
vaultStaticSecrets:
- name: minio-vss
path: infrastructure/minio
destination:
name: velero-s3-credentials
transformation:
templates:
cloud: |
[default]
aws_access_key_id={{ .Secrets.MINIO_ROOT_USER }}
aws_secret_access_key="{{ .Secrets.MINIO_ROOT_PASSWORD }}"
백업 정책
기본 설정
configuration:
defaultBackupTTL: 168h # 7일 보존
defaultVolumesToFsBackup: true # 모든 PV를 파일시스템 백업
restoreOnlyMode: false
백업 제외 설정
# 백업 검증 비활성화 (수동 백업만 사용)
storeValidationFrequency: 0s
backupSyncPeriod: 0s
ArgoCD 동기화 트리거를 방지하기 위해 자동 검증을 비활성화합니다.
모니터링 설정
metrics:
enabled: true
serviceMonitor:
enabled: true
prometheusRule:
enabled: false # Prometheus Rule 자동 생성 비활성화
Velero UI
UI 설정
# Velero UI Helm Values
image:
repository: zot.lumie-infra.com/otwld/velero-ui
tag: "0.10.1"
pullPolicy: IfNotPresent
replicaCount: 1
resources:
requests:
cpu: 15m
memory: 256Mi
limits:
memory: 256Mi
service:
type: ClusterIP
port: 3000
env:
- name: BASIC_AUTH_ENABLED
value: "false"
podSecurityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
serviceAccount:
create: true
name: velero-ui
접근 방법
- 내부:
velero-ui.velero.svc.cluster.local:3000 - 외부: Teleport Web App 터널
공개 인그레스는 보안상 비활성화되어 있습니다.
백업 작업
수동 백업
전체 클러스터 백업
# 모든 리소스 백업
velero backup create full-backup-$(date +%Y%m%d-%H%M%S)
# 특정 네임스페이스 백업
velero backup create lumie-backup \
--include-namespaces lumie-dev,lumie-prod
# 특정 리소스 타입 백업
velero backup create config-backup \
--include-resources configmaps,secrets
PVC 백업
# 파일시스템 백업 포함
velero backup create pvc-backup \
--default-volumes-to-fs-backup
# 특정 PVC만 백업
velero backup create postgres-backup \
--include-resources persistentvolumeclaims \
--selector app=postgresql
스케줄 백업
apiVersion: velero.io/v1
kind: Schedule
metadata:
name: daily-backup
namespace: velero
spec:
schedule: "0 2 * * *" # 매일 오전 2시
template:
includedNamespaces:
- lumie-dev
- lumie-prod
- lumie-cache
- lumie-db
defaultVolumesToFsBackup: true
ttl: 168h0m0s # 7일 보존
백업 상태 확 인
# 백업 목록 조회
velero backup get
# 백업 상세 정보
velero backup describe <backup-name>
# 백업 로그 확인
velero backup logs <backup-name>
복원 작업
전체 복원
# 백업에서 전체 복원
velero restore create restore-$(date +%Y%m%d-%H%M%S) \
--from-backup <backup-name>
# 특정 네임스페이스만 복원
velero restore create lumie-restore \
--from-backup <backup-name> \
--include-namespaces lumie-dev
선택적 복원
# 특정 리소스만 복원
velero restore create config-restore \
--from-backup <backup-name> \
--include-resources configmaps,secrets \
--selector app=postgresql
# 라벨 셀렉터로 복원
velero restore create app-restore \
--from-backup <backup-name> \
--selector app=postgresql
네임스페이스 매핑
# 다른 네임스페이스로 복원
velero restore create test-restore \
--from-backup <backup-name> \
--namespace-mappings lumie-prod:lumie-test
복원 상태 확인
# 복원 목록 조회
velero restore get
# 복원 상세 정보
velero restore describe <restore-name>
# 복원 로그 확인
velero restore logs <restore-name>