2 min de lectura
GitOps on OpenShift with ArgoCD
GitOps is a modern approach to continuous delivery that uses Git as the single source of truth for declarative infrastructure and applications.
What is GitOps?
GitOps principles:
- Declarative: Everything is described in Git
- Versioned: Full history of changes
- Automated: Changes applied automatically
- Auditable: Who changed what and when
Installing ArgoCD on OpenShift
# Create namespace
oc new-project argocd
# Install ArgoCD operator from OperatorHub
oc apply -f - <<EOF
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
name: argocd
namespace: argocd
spec:
server:
route:
enabled: true
EOF
Creating an Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/org/my-app.git
targetRevision: main
path: k8s/overlays/production
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true
selfHeal: true
Directory Structure
my-app/
βββ base/
β βββ deployment.yaml
β βββ service.yaml
β βββ kustomization.yaml
βββ overlays/
βββ development/
β βββ kustomization.yaml
βββ production/
βββ kustomization.yaml
Benefits
- Consistency: Same deployment process everywhere
- Recovery: Easy rollback via Git revert
- Security: No direct cluster access needed
- Compliance: Full audit trail
Conclusion
GitOps with ArgoCD on OpenShift provides a robust, auditable, and automated deployment pipeline. Embrace the GitOps model to improve your delivery velocity and reliability.
Liked it? Share it!
Comments (0)