GitOps与ArgoCD实践指南
3 阅读
预计 3 分钟
GitOps使用Git作为单一事实来源管理基础设施和应用。ArgoCD是其最流行的实现。
## ArgoCD Application定义
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/org/myapp-manifests.git
targetRevision: main
path: overlays/production
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true
selfHeal: true
```
## App of Apps模式
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: apps
spec:
source:
repoURL: https://github.com/org/argocd-apps.git
path: apps
```
GitOps让基础设施管理像代码一样可审计、可回滚、可自动化。
0 条评论 欢迎参与讨论