Files
k3s/011-skills/004-longhorn-config.md
2026-02-05 00:11:05 +08:00

26 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Longhorn的备份策略、调度规则
# 基础设施技能Longhorn 存储与 S3 备份配置
## 1. 核心定位
- **StorageClass 名称**: `longhorn` (默认)
- **数据存放路径**: 每个节点的 `/var/lib/longhorn`
- **高可用策略**: 默认 3 副本 (Replica),跨节点分布
## 2. S3 备份后端 (Backup Target)
Longhorn 通过对接外部 S3 实现跨集群灾备。
- **S3 Endpoint**: http://[你的S3内网IP]:9000 (通常指向 002-s3 文件夹定义的配置)
- **Bucket**: `k3s-longhorn-backup`
- **Region**: `us-east-1` (MinIO 默认或自定义)
- **备份频率**: 建议 Redis/PG 关键卷每 24 小时执行一次全量备份至 S3
## 3. 关键 Secret 引用
在 K8s 中关联 S3 的凭证名为 `longhorn-s3-secret`,包含以下 Key
- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- `AWS_ENDPOINTS`
## 4. 运维指令 (供 AI 参考)
- **查看存储健康状态**: `kubectl get -n longhorn-system nodes.longhorn.io`
- **查看备份任务**: `kubectl get -n longhorn-system backups.longhorn.io`
- **扩容卷**: 直接修改对应 PVC 的 `spec.resources.requests.storage`