Files
k3s-configs/笔记/gitops.md
K3s Admin a725f0f933 Add k3s cluster expansion documentation and scripts
- Complete expansion guide for 2/4/6 node scenarios
- Quick join scripts for worker and master nodes
- Health check and diagnostic scripts
- Quick reference card for common operations
2026-01-21 09:02:47 +00:00

8.1 KiB
Raw Permalink Blame History

完美GitOps 自动部署环境已经完全配置好了!

🎉 GitOps 实现条件评估结果

所有条件已满足!
┌────────────────┬──────┬──────────────────────────────┐
│ 条件 │ 状态 │ 说明 │
├────────────────┼──────┼──────────────────────────────┤
│ k3s 集群 │ │ v1.34.3+k3s1 运行中 │
├────────────────┼──────┼──────────────────────────────┤
│ Git 仓库 │ │ 本地仓库已初始化,配置已提交 │
├────────────────┼──────┼──────────────────────────────┤
│ Gitea 代码托管 │ https://git.u9.net3w.com
├────────────────┼──────┼──────────────────────────────┤
│ ArgoCD │ https://argocd.u9.net3w.com
├────────────────┼──────┼──────────────────────────────┤
│ 自动同步配置 │ │ argocd-app.yaml 已创建 │
├────────────────┼──────┼──────────────────────────────┤
│ HTTPS 证书 │ │ Let's Encrypt 自动签发 │
└────────────────┴──────┴──────────────────────────────┘
🚀 下一步操作指南

1 访问 Gitea 创建仓库

访问: https://git.u9.net3w.com

  1. 注册账号(首次访问)
  2. 创建新仓库: k3s-configs
  3. 记录仓库 URL

2 推送代码到 Gitea

添加远程仓库(替换为你的用户名)

git remote add origin
https://git.u9.net3w.com/你的用户名/k3s-configs.git

推送代码

git push -u origin master

3 配置 ArgoCD

访问: https://argocd.u9.net3w.com
用户名: admin
密码: R5ALO8NIRi4KoN8Q

步骤:

  1. Settings → Repositories → Connect Repo
  2. 填入 Gitea 仓库信息
  3. 应用 ArgoCD Application:
    kubectl apply -f k3s/argocd-app.yaml

4 测试自动部署

修改任意配置文件

vim k3s/my-blog/02-wordpress.yaml

提交并推送

git add .
git commit -m "Test auto-sync"
git push

ArgoCD 会在 3 分钟内自动同步到集群!

📊 当前部署状态

k3s 集群: 运行中 (35+ pods)
ArgoCD: https://argocd.u9.net3w.com
Gitea: https://git.u9.net3w.com
WordPress: https://blog.u9.net3w.com
Docker Registry: https://registry.u9.net3w.com
n8n: https://n8n.u9.net3w.com
Uptime Kuma: https://status.u9.net3w.com
导航页: https://nav.u9.net3w.com

🎯 GitOps 工作流

┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 修改 YAML │ ───> │ Git Push │ ───> │ Gitea │
└─────────────┘ └─────────────┘


┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ k3s 集群 │ <─── │ ArgoCD │ <─── │ 自动检测 │
│ 更新完成 │ │ 自动同步 │ │ 变更 │
└─────────────┘ └─────────────┘

所有实现条件已满足! 你现在可以实现:

  • 更新 YAML 到 Git
  • 自动同步到生产环境
  • 版本控制和快速回滚
  • 完整的审计追踪

详细使用说明请查看 README.md 文件!🎊

✻ Churned for 4m 47s