Giter VIP home page Giter VIP logo

multicluster-management-rhacm-argocd's Introduction

Managing multiple OpenShift/Kubernetes clusters using RHACM and Argo CD

Overview

Components used:

  • Kubernetes External Secrets (formerly known as GoDaddy External Secrets)
    • Fetches the secret data from HashiCorp Vault or possibly other sources and using this secret data it creates Kubernetes Secrets on the cluster.
  • Red Hat Advanced Cluster Management (RHACM)
    • Deploys new OpenShift clusters
    • Deploys External Secrets on the Hub cluster and managed clusters
    • Deploys Argo CD on the Hub cluster
    • Deploys AppProject and Application objects that instruct Argo CD how to configure clusters
  • Argo CD
    • Manages clusters using the GitOps approach

Deploying

The boostrap directory contains a set of Kubernetes manifests that need to be deployed to the Hub cluster.

First, find the values in those manifests that have to be replaced:

$ grep -rn REPLACE *

Edit the manifests and replace the values with your custom configuration.

Second, apply the manifests to the Hub cluster:

$ oc apply --kustomize bootstrap/external-secrets
$ oc apply --kustomize bootstrap/gitops-namespace
$ oc apply --kustomize bootstrap/gitops-operator
$ oc apply --kustomize bootstrap/argocd-apps

Directory structure

The repository consists of several top-level directories:

  • bootstrap directory contains manifests that should be deployed first. This deployment can be automated using Ansible. Bootstrap manifests deploy Kubernetes External Secrets operator to the managed clusters. They also deploy Argo CD on the Hub cluster plus all Argo CD application manifests.
  • applications directory contains Argo CD application manifests. These manifests are deployed by RHACM after the manifests from the boostrap directory have been applied. The applications directory contains Argo CD application configuration for all managed clusters.
  • aggregates directory contains kustomizations that combine the kustomizations from the manifests directory. After applying a kustomization from the aggregates directory, an arbitrary number of kustomizations from the manifests directory are applied in one shot. Note that the aggregates directory is meant only for combining the kustomizations. There is no overlay configuration in this directory. Overlays are defined in the manifests directory. Aggregates are deployed by the Argo CD applications.
  • manifests directory contains individual configurations applied to the clusters. They are typically grouped into aggregates so that they can be applied at once. This directory also contains overlays which allow to specify configuration differences between individual clusters/environments.

Object management

Kubernetes objects can be divided into two categories:

  1. Objects that are owned by the GitOps management. These objects are created and deleted by GitOps. Argo CD assumes by default that it owns all objects under its management. After the object has been deleted in the git repository and the object is allowed to be pruned, Argo CD will delete this object on the cluster during the next sync-up. In RHACM, we annotate the Subscription with apps.open-cluster-management.io/reconcile-option: replace to achieve a similar behaviour.

  2. Objects that are modified by the GitOps management. These objects were created on the cluster by other means. GitOps is supposed to modify these objects but should never try to delete them. In Argo CD, we apply the following annotation to these objects: argocd.argoproj.io/sync-options: Prune=false. This prevents Argo CD from deleting these ojects (Prune=false) after they have been removed from the git repository even when the sync operation was executed with prune=true. Note that Argo CD will still try to delete the object if you for example delete your application using argocd app delete --cascade or if you click Delete in the Web UI. In RHACM, annotate the Subscription with apps.open-cluster-management.io/reconcile-option: merge to prevent RHACM from ever trying to delete the object.

Why is Argo CD's self-heal enabled in this repo?

  • If the cluster's state has been changed (for example manually by the user) and it now differs from the state in git, Argo CD should restore the cluster state to match the configuration in git.
  • If the reconciliation of objects on the cluster fails, we would like Argo CD to keep trying. This is what other OpenShift operators typically do, they keep trying until the object is reconciled successfully.

TODO

References

To create this repo, I drew ideas and inspiration from:

Content that can be installed on the cluster via Argo CD:

multicluster-management-rhacm-argocd's People

Contributors

noseka1 avatar yajuvendrarawat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.