Working with Argo CD

This topic walks you through how to use the Argo CD to manage your workload across clusters with Karmada.

Prerequisites

Argo CD Installation

You have installed Argo CD following the instructions in Getting Started.

Karmada Installation

In this example, we are using a Karmada environment with at least 3 member clusters joined.

You can set up the environment by hack/local-up-karmada.sh, which is also used to run our E2E cases.

  1. $ kubectl get clusters
  2. NAME VERSION MODE READY AGE
  3. member1 v1.19.1 Push True 18h
  4. member2 v1.19.1 Push True 18h
  5. member3 v1.19.1 Pull True 17h

Registering Karmada to Argo CD

This step registers Karmada control plane to Argo CD.

First list the contexts of all clusters in your current kubeconfig:

  1. kubectl config get-contexts -o name

Choose the context of the Karmada control plane from the list and add it to argocd cluster add CONTEXTNAME. For example, for karmada-apiserver context, run:

  1. argocd cluster add karmada-apiserver

If everything goes well, you can see the registered Karmada control plane from the Argo CD UI, e.g.:

Working with Argo CD - 图1

Creating Apps Via UI

Preparing Apps

Take the guestbook as example.

First, fork the argocd-example-apps repo and create a branch karmada-demo.

Then, create a PropagationPolicy manifest under the guestbook directory.

Creating Apps

Click the + New App button as shown below:

Working with Argo CD - 图2

Give your app the name guestbook-multi-cluster, use the project default, and leave the sync policy as Manual:

Working with Argo CD - 图3

Connect the forked repo to Argo CD by setting repository url to the github repo url, set revision as karmada-demo, and set the path to guestbook:

Working with Argo CD - 图4

For Destination, set cluster to karmada and namespace to default:

Working with Argo CD - 图5

Syncing Apps

You can sync your applications via UI by simply clicking the SYNC button and following the pop-up instructions, e.g.:

Working with Argo CD - 图6

More details please refer to argocd guide: sync the application.

Checking Apps Status

For deployment running in more than one clusters, you don’t need to create applications for each cluster. You can get the overall and detailed status from one Application.

Argo CD < v2.6.0

Working with Argo CD - 图7

Argo CD >= v2.6.0

Working with Argo CD - 图8

The svc/guestbook-ui, deploy/guestbook-ui and propagationpolicy/guestbook in the middle of the picture are the resources created by the manifest in the forked repo. And the resourcebinding/guestbook-ui-service and resourcebinding/guestbook-ui-deployment in the right of the picture are the resources created by Karmada.

Checking Detailed Status

You can obtain the Deployment’s detailed status by resourcebinding/guestbook-ui-deployment.

Working with Argo CD - 图9

Checking Aggregated Status

You can obtain the aggregated status of the Deployment from UI by deploy/guestbook-ui.

Working with Argo CD - 图10