- Learn various sync Policy & Option provided by ArgoCD
- auto-prune
- auto-sync
- Edit the file in
manifests/ArgoCD101-GuestbookManifests/kustomization.yaml
comment outservice.yaml
- Commit the changes and push to the main branch of your forked repo.
- Login into ArgoCD using the user id
admin
andpassword
(same credentials used in exercise1). - Go to the application and click on the
APP DIFF
button(click on Refresh button to see OutOfSync resource) - The service object marked in red needs to be pruned (deleted).
- Select the sync with prune option, then apply the sync operation. After a successful sync, the service resource will be deleted.
- The health of the application will be marked as
green
, and the state of the application matches the desired state.
- 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 ...
- 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.