Add HTTPS deployment summary and troubleshooting guide
- Complete deployment status - ArgoCD HTTPS configuration fix explanation - Idempotency guarantees - Troubleshooting procedures - Maintenance checklist Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
188
DEPLOYMENT-SUMMARY.md
Normal file
188
DEPLOYMENT-SUMMARY.md
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
# HTTPS配置部署总结
|
||||||
|
|
||||||
|
## ✅ 部署状态
|
||||||
|
|
||||||
|
### 已完成的组件
|
||||||
|
|
||||||
|
1. **cert-manager** - 自动证书管理
|
||||||
|
- 版本: v1.13.3
|
||||||
|
- 状态: 运行正常
|
||||||
|
- 命名空间: cert-manager
|
||||||
|
|
||||||
|
2. **ClusterIssuer** - Let's Encrypt证书签发
|
||||||
|
- letsencrypt-prod (生产环境) - Ready ✅
|
||||||
|
- letsencrypt-staging (测试环境) - Ready ✅
|
||||||
|
|
||||||
|
3. **SSL证书** - 所有证书已成功签发
|
||||||
|
```
|
||||||
|
NAMESPACE NAME READY SECRET
|
||||||
|
argocd argocd-tls-cert True argocd-tls-cert
|
||||||
|
default test-app-tls-cert True test-app-tls-cert
|
||||||
|
gitea gitea-tls-cert True gitea-tls-cert
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **HTTPS Ingress** - 所有服务已启用HTTPS
|
||||||
|
- ArgoCD: https://argocd.jpc.net3w.com ✅
|
||||||
|
- Gitea: https://git.jpc.net3w.com ✅
|
||||||
|
- Test App: https://test.jpc.net3w.com ✅
|
||||||
|
|
||||||
|
## 🔧 关键配置修复
|
||||||
|
|
||||||
|
### ArgoCD HTTPS配置
|
||||||
|
|
||||||
|
**问题**: ArgoCD默认使用自签名证书,与Ingress TLS终止冲突
|
||||||
|
|
||||||
|
**解决方案**: 配置ArgoCD以insecure模式运行(HTTP),让Ingress处理TLS终止
|
||||||
|
|
||||||
|
**配置文件**: `manifests/07-argocd-insecure-config.yaml`
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: argocd-cmd-params-cm
|
||||||
|
namespace: argocd
|
||||||
|
data:
|
||||||
|
server.insecure: "true"
|
||||||
|
```
|
||||||
|
|
||||||
|
**原理**:
|
||||||
|
- Ingress在443端口接收HTTPS请求
|
||||||
|
- Ingress使用cert-manager签发的证书进行TLS终止
|
||||||
|
- Ingress将解密后的HTTP请求转发到ArgoCD的80端口
|
||||||
|
- ArgoCD以HTTP模式运行,无需处理TLS
|
||||||
|
|
||||||
|
## 📁 Git仓库结构
|
||||||
|
|
||||||
|
```
|
||||||
|
https-config/
|
||||||
|
├── README.md # 说明文档
|
||||||
|
├── DEPLOYMENT-SUMMARY.md # 本文档
|
||||||
|
└── manifests/
|
||||||
|
├── 01-namespace.yaml # cert-manager命名空间
|
||||||
|
├── 02-cert-manager.yaml # cert-manager RBAC
|
||||||
|
├── 03-clusterissuer.yaml # Let's Encrypt配置
|
||||||
|
├── 04-ingress-argocd-tls.yaml # ArgoCD HTTPS Ingress
|
||||||
|
├── 05-ingress-gitea-tls.yaml # Gitea HTTPS Ingress
|
||||||
|
├── 06-ingress-test-app-tls.yaml # test-app HTTPS Ingress
|
||||||
|
└── 07-argocd-insecure-config.yaml # ArgoCD insecure模式配置
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔄 幂等性保证
|
||||||
|
|
||||||
|
### GitOps管理
|
||||||
|
- ✅ 所有配置存储在Git仓库
|
||||||
|
- ✅ ArgoCD自动同步Git变更
|
||||||
|
- ✅ 支持重复应用,不会产生副作用
|
||||||
|
- ✅ 配置变更有完整历史记录
|
||||||
|
|
||||||
|
### 部署流程
|
||||||
|
```
|
||||||
|
修改Git配置 → ArgoCD检测变更 → 自动同步到集群 → 配置生效
|
||||||
|
```
|
||||||
|
|
||||||
|
### 验证幂等性
|
||||||
|
```bash
|
||||||
|
# 重新应用所有配置(应该无变化)
|
||||||
|
kubectl apply -f manifests/
|
||||||
|
|
||||||
|
# 检查ArgoCD同步状态
|
||||||
|
kubectl get application https-config -n argocd
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔍 故障排查
|
||||||
|
|
||||||
|
### 证书未就绪
|
||||||
|
```bash
|
||||||
|
# 检查证书状态
|
||||||
|
kubectl get certificate -A
|
||||||
|
|
||||||
|
# 查看证书详情
|
||||||
|
kubectl describe certificate <cert-name> -n <namespace>
|
||||||
|
|
||||||
|
# 检查cert-manager日志
|
||||||
|
kubectl logs -n cert-manager deployment/cert-manager
|
||||||
|
```
|
||||||
|
|
||||||
|
### HTTPS无法访问
|
||||||
|
```bash
|
||||||
|
# 检查Ingress状态
|
||||||
|
kubectl get ingress -A
|
||||||
|
|
||||||
|
# 检查Traefik日志
|
||||||
|
kubectl logs -n kube-system -l app.kubernetes.io/name=traefik
|
||||||
|
|
||||||
|
# 测试内部访问
|
||||||
|
curl -k -I https://localhost/ -H "Host: <domain>"
|
||||||
|
```
|
||||||
|
|
||||||
|
### ArgoCD无法访问
|
||||||
|
```bash
|
||||||
|
# 检查ArgoCD配置
|
||||||
|
kubectl get configmap argocd-cmd-params-cm -n argocd -o yaml
|
||||||
|
|
||||||
|
# 检查ArgoCD日志
|
||||||
|
kubectl logs -n argocd deployment/argocd-server
|
||||||
|
|
||||||
|
# 验证insecure模式
|
||||||
|
kubectl get configmap argocd-cmd-params-cm -n argocd -o jsonpath={.data.server.insecure}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📊 证书自动续期
|
||||||
|
|
||||||
|
cert-manager会自动管理证书续期:
|
||||||
|
- **检查周期**: 每小时检查一次
|
||||||
|
- **续期时间**: 证书到期前30天
|
||||||
|
- **续期方式**: 自动向Let's Encrypt申请新证书
|
||||||
|
- **无需人工干预**: 完全自动化
|
||||||
|
|
||||||
|
## 🔐 安全建议
|
||||||
|
|
||||||
|
1. **DNS解析**: 确保域名正确解析到集群IP
|
||||||
|
2. **防火墙规则**: 开放443端口(HTTPS)
|
||||||
|
3. **证书监控**: 定期检查证书状态
|
||||||
|
4. **备份证书**: 虽然会自动续期,但建议备份Secret
|
||||||
|
5. **速率限制**: Let's Encrypt有速率限制,避免频繁申请
|
||||||
|
|
||||||
|
## 🎯 访问验证
|
||||||
|
|
||||||
|
### 从外部访问(需要DNS和防火墙配置)
|
||||||
|
```bash
|
||||||
|
curl -I https://argocd.jpc.net3w.com
|
||||||
|
curl -I https://git.jpc.net3w.com
|
||||||
|
curl -I https://test.jpc.net3w.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### 从集群内部访问
|
||||||
|
```bash
|
||||||
|
kubectl run -it --rm debug --image=curlimages/curl --restart=Never -- \
|
||||||
|
curl -k -I https://argocd.jpc.net3w.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📝 维护清单
|
||||||
|
|
||||||
|
### 日常维护
|
||||||
|
- [ ] 每周检查证书状态
|
||||||
|
- [ ] 每月检查cert-manager日志
|
||||||
|
- [ ] 每季度验证自动续期功能
|
||||||
|
|
||||||
|
### 配置变更
|
||||||
|
- [ ] 修改Git仓库中的配置文件
|
||||||
|
- [ ] 提交并推送到Gitea
|
||||||
|
- [ ] 等待ArgoCD自动同步(3分钟内)
|
||||||
|
- [ ] 验证变更生效
|
||||||
|
|
||||||
|
### 添加新服务
|
||||||
|
1. 创建Ingress配置,添加TLS和cert-manager注解
|
||||||
|
2. 提交到Git仓库
|
||||||
|
3. ArgoCD自动部署
|
||||||
|
4. cert-manager自动申请证书
|
||||||
|
|
||||||
|
## 🎉 总结
|
||||||
|
|
||||||
|
✅ **HTTPS配置完成**: 所有服务已启用HTTPS
|
||||||
|
✅ **证书自动管理**: cert-manager自动申请和续期
|
||||||
|
✅ **GitOps化**: 配置存储在Git,支持版本控制
|
||||||
|
✅ **幂等性保证**: 可以安全重复应用配置
|
||||||
|
✅ **自动化**: 修改Git自动部署,无需手动操作
|
||||||
|
|
||||||
|
您的K3s集群现在已经完全支持HTTPS,并通过GitOps实现了自动化和幂等性管理!
|
||||||
Reference in New Issue
Block a user