Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 2.14 KB

exercise4.md

File metadata and controls

63 lines (49 loc) · 2.14 KB

Exercise 4: Setting Sync Policy & Options

Overview

  • Learn various sync Policy & Option provided by ArgoCD
    • auto-prune
    • auto-sync

Steps

  1. Edit the file in manifests/ArgoCD101-GuestbookManifests/kustomization.yaml comment out service.yaml
  2. Commit the changes and push to the main branch of your forked repo.
  3. Login into ArgoCD using the user id admin and password (same credentials used in exercise1).
  4. Go to the application and click on the APP DIFF button(click on Refresh button to see OutOfSync resource)
  5. The service object marked in red needs to be pruned (deleted).
  6. Select the sync with prune option, then apply the sync operation. After a successful sync, the service resource will be deleted.
  7. The health of the application will be marked as green, and the state of the application matches the desired state.

Optional Step

  1. Using Argo CD cli, change the guestbook application to sync automatically
Click to view solution
  • Run the below commands:
    argocd --port-forward --port-forward-namespace argocd login
    argocd --port-forward-namespace argocd app set guestbook  --sync-policy automated
  • Verify the change applied in the application:
    argocd --port-forward-namespace argocd app get guestbook
    Output:
    ...
    Sync Policy:        Automated
    ...
  1. The application can be configured with the various Sync options. Look for these options (Prune Last,Apply Out of Sync Only) in Argo CD UI and try to understand how it changes the sync process.
Click to view solution
  • Edit the application on the ArgoCD UI.
  • Select and Save the Sync option you want to enable in the application.
  • Usually in production, you will use CLI or add annotation to your Gitops application manifest.

References