Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023 08 22 argo cd configuration drift #3363

Merged
merged 107 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
1da6fed
Create 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Aug 22, 2023
c054003
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Aug 23, 2023
8379ba9
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Aug 28, 2023
420c836
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Aug 30, 2023
a11ef9e
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Aug 31, 2023
83a5d3c
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Aug 31, 2023
4a04171
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Aug 31, 2023
6814a7c
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Aug 31, 2023
4bb3c6c
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 1, 2023
19e735e
Add files via upload
danielguinan1 Sep 1, 2023
0efded8
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 1, 2023
b4f7a6b
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 1, 2023
9186cfc
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 3, 2023
3a4608d
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 8, 2023
7983ba7
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 12, 2023
0403f91
Add files via upload
danielguinan1 Sep 14, 2023
938a7d4
Add files via upload
danielguinan1 Sep 14, 2023
92cc66e
Delete img/blog/configuration-drift-chart.png
danielguinan1 Sep 14, 2023
f829e73
Add files via upload
danielguinan1 Sep 14, 2023
1849815
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 14, 2023
92b3292
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 14, 2023
229c888
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 14, 2023
0247c5e
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 14, 2023
1c7c45a
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 18, 2023
952a648
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 18, 2023
cde774f
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 18, 2023
3f9f042
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 18, 2023
15ae040
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 18, 2023
2b37e96
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 18, 2023
5cff3a7
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Sep 19, 2023
9557514
Add files via upload
danielguinan1 Sep 20, 2023
6b92207
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Sep 20, 2023
24f5b04
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Oct 3, 2023
2976308
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Oct 18, 2023
4fb5ddc
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Oct 19, 2023
9b9388c
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Feb 6, 2024
3bbc967
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Feb 6, 2024
e40062d
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Feb 6, 2024
bf8f857
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Feb 6, 2024
e35586f
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
mtamboli Feb 9, 2024
7184f47
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Feb 14, 2024
a45e417
Update 2023-08-22-ArgoCD-Configuration-Drift.adoc
danielguinan1 Feb 19, 2024
2c523b7
suggested edits from Grace review
Mar 28, 2024
e6b7ea8
changing date of blog
Mar 28, 2024
2b866cd
Apply suggestions from code review
GraceJansen Apr 5, 2024
6d3e552
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
87fa748
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
4c2e46e
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
94c715b
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
e96e75a
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
85cbabb
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
069fa7b
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
2df2f6f
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
c75a3e0
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
bb94fd1
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
f590d08
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
e3a1b61
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
22a70cf
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
aedfc8e
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
1d194bd
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
b44e72f
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
7886d19
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
28b6702
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
e5f2f77
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
7f8c3a7
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
ac18ff7
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
67583b5
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
a68ef78
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
36d961b
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
5a22ab3
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
5661934
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
4676481
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
5ec2c51
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
77aa328
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
b66788d
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
b74d2e4
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 17, 2024
5b1d6ea
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
44b92a1
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
7bbd11b
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
69abfe1
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
36bea09
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
91810d0
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
fb589a2
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 18, 2024
f706285
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
cb98ec4
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
564e351
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
08d60e8
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
97a67ee
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
48528f8
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
e2e4c0b
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
186a393
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
912218d
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
c8f242a
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
dd0e6b0
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
8638b78
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
23c80d2
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
8e9a310
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
49d2db7
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
c3c3361
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
9c8b6cb
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
f7139ae
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
27ae61e
Update posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 22, 2024
dbb1ecc
edits
dmuelle Apr 23, 2024
8de8204
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
dmuelle Apr 23, 2024
8c6c3d6
acrolinx edits
dmuelle Apr 23, 2024
0f6349d
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 24, 2024
b3361cf
Update 2024-03-29-ArgoCD-Configuration-Drift.adoc
danielguinan1 Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added img/blog/configuration-drift-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-outofsync.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/blog/configuration-drift-synced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
210 changes: 210 additions & 0 deletions posts/2024-03-29-ArgoCD-Configuration-Drift.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
---
layout: post
title: "A solution to configuration drift - deploying Open Liberty with GitOps"
# Do NOT change the categories section
categories: blog
author_picture: https://avatars3.githubusercontent.com/danielguinan1
author_github: https://github.com/danielguinan1
seo-title: A solution to configuration drift - deploying Open Liberty with GitOps - OpenLiberty.io
seo-description: Learn how to deploy an Open Liberty Application with GitOps
blog_description: "Learn how to deploy an Open Liberty Application with GitOps"
open-graph-image: https://openliberty.io/img/twitter_card.jpg
open-graph-image-alt: Open Liberty Logo
additional_authors:
- name: Monica Tamboli
github: https://github.com/mtamboli
image: https://avatars0.githubusercontent.com/mtamboli
---
= A solution to configuration drift - deploying Open Liberty with GitOps
Daniel Guinan <https://github.com/danielguinan1>
:imagesdir: /
:url-prefix:
:url-about: /

Many organizations are struggling with configuration drift, and GitOps provides a robust solution. If you're unfamiliar with what configuration drift is or how GitOps can help mitigate it, check out part 1 of this two-part series: link:{url-prefix}/blog/2024/03/12/argocd-drift-pt1.html[Configuration drift: Why it's bad and how to solve it with GitOps and ArgoCD]

In this post, part 2 of this series, we demonstrate how to practically apply the solutions we introduced in part 1. We walk through the deployment of an Open Liberty application to a Kubernetes cluster by using a continuous deployment approach with GitOps and ArgoCD. ArgoCD is a leading GitOps tool that automates application deployment and ensures configuration consistency, effectively preventing configuration drift.

* <<setup_argocd, Set up ArgoCD>>
* <<setup_gitops_repo, Set up a GitOps repo for your app>>
* <<deploy_app_with_gitops, Deploy a Java application with GitOps and ArgoCD>>
* <<manually_sync, Manually sync your app>>
* <<gitops_solve_config_drift, How GitOps solves configuration drift>>

== Preparing your cluster

In this post, we assume you have some form of Kubernetes cluster that you can access by using the `kubectl` CLI or `oc` CLI if on Red Hat OpenShift.

=== Simplifying deployment with the Open Liberty Operator

The Open Liberty Operator streamlines the deployment and management of Open Liberty applications on Kubernetes. Instead of manually crafting Kubernetes resources like services, deployments, and routes, the operator lets us define only a few application details to automatically generate the required Kubernetes resources - saving us time and effort. Furthermore, it simplifies Day 2 operations such as traces and heap memory dumps. For more on the Open Liberty Operator, check out the link:{url-prefix}/docs/latest/open-liberty-operator.html[documentation].

To get these benefits, we use the Open Liberty Operator to deploy an application with the following commands, which install the operator with its default configuration (watching all namespaces):

[source,console]
----
git clone https://github.com/OpenLiberty/open-liberty-operator.git
kubectl create namespace open-liberty
kubectl apply --server-side -k open-liberty-operator/deploy/releases/1.3.1/kustomize/overlays/watch-all-namespaces
----

For a more detailed tutorial on using the Open Liberty Operator, see our interactive guide: https://openliberty.io/guides/openliberty-operator-intro.html[Deploying a microservice to Kubernetes using Open Liberty Operator].

[#setup_argocd]
=== Set up ArgoCD for effective GitOps and continuous deployment

ArgoCD follows a GitOps pattern of using Git repositories as the source of truth to define the application state, which we will use to deploy and monitor our Open Liberty configuration repository. ArgoCD helps us identify any drift that occurs between the current cluster state and the desired state in the configuration repository.

First, we use the following commands from the https://argo-cd.readthedocs.io/en/stable/getting_started/[Quickstart section] of the ArgoCD docs to create a namespace that is called `argocd` and install ArgoCD by applying manifests to that namespace.

[source,console]
----
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
----

Next, we need to get the default Admin credentials to access the ArgoCD user interface (UI). Using the ArgoCD UI is a great way to get started, allowing us to create our application and identify configuration drift in a visual way.
To get the default Admin password, run the following command:

[source,console]
----
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath='{.data.password}' | base64 -d
----

To access the ArgoCD UI, go to the route of the `argocd-server` if on OpenShift, via ingress if configured, or by port forwarding with `kubectl port-forward svc/argocd-server -n argocd 8080:443` and visting `https://localhost:8080/`. Then log with the `admin` username and password.

[.img_border_light]
image::/img/blog/configuration-drift-1.png[Argo Login,width=70%,align="center"]

Once logged in, you'll see the ArgoCD landing page, similar to the following screenshot:

[.img_border_light]
image::/img/blog/configuration-drift-2.png[Argo Home,width=70%,align="center"]

[#setup_gitops_repo]
== Setting up a GitOps repository for your application
Now that you've installed ArgoCD and accessed its console, the next step is to set up a GitHub repository for ArgoCD to synchronize with. In our example, we created a deployment directory in the application code repo that we point ArgoCD to for deployment.

For this particular example, because it's just a small demo application, we put the deployment configuration in the same repository as the application code. However, in general, it's better to separate the deployment configuration into a separate repository from the application code. This strategy aligns with recommended best practices to maintain separation between configuration repositories and code repositories. Keeping these separate ensures that infrastructure changes are decoupled from application changes, allowing for more granular control, better audit trails, and reduced risk of unintended side-effects. For more information, see https://argo-cd.readthedocs.io/en/stable/user-guide/best_practices/[ArgoCD's documentation on best practices].

For the purposes of this post, we'll use the Daytrader7 sample application. This application is built around the concept of an online stock trading system, and the Daytrader7 https://github.com/WASdev/sample.daytrader7#readme[README] provides a comprehensive overview. In this example, we have a `deploy` directory within our existing repository to house the deployment configuration. This directory contains the manifests for full application deployment and annotations that tell ArgoCD which order they should be deployed in.

To begin, fork this repository: https://github.com/WASdev/sample.daytrader7. Use your forked repository when configuring ArgoCD in the following steps.

In this example, we have a pre-built container image for the DayTrader sample application pushed to Docker Hub that is used in the `deploy/daytrader7-deploy.yaml` deployment file. For more information on how to containerize your Open Liberty application, check out our interactive guide: https://openliberty.io/guides/docker.html[Using Docker containers to develop microservices].

[#deploy_app_with_gitops]
== Deploying a Java application with GitOps and ArgoCD

Now that the Git repository is forked and ready for deployment, it’s time to configure ArgoCD to deploy the application.

1. Go to the ArgoCD console dashboard.

2. Click **New App** in the console.
+
This button opens a window where you give ArgoCD the details on the application you want to deploy, as shown in the following image.
+
[.img_border_light]
image::/img/blog/configuration-drift-3.png[Creating the App,width=70%,align="center"]

3. For our demo application, enter the following values:
+
**Application Name**: daytrader7
+
**Project**: Leave as "Default". This setting groups applications together for large-scale deployments, which is not needed in our case.
+
**SYNC POLICY**: Manual. This configuration option determines whether we want ArgoCD to automatically correct configuration drift or wait for us to manually tell it to.
+
**SYNC OPTIONS**: Select the **Auto-Create Namespace** box, which creates the namespace if it doesn't already exist.

4. Scroll down to the configuration section labeled **SOURCE**, as shown in the following image.
+
[.img_border_light]
image::/img/blog/configuration-drift-4.png[Setting the Repo,width=70%,align="center"]

5. Change the **Repository URL** to your newly forked repo. This tells ArgoCD what Git repository has the configuration for the application you want to deploy.

6. Change the **Path** to the path in the git repo where ArgoCD is looking for deployment files to deploy.

7. Set the **Cluster URL**.
+
In this example, we set it to `\https://kubernetes.default.svc`, which is the local cluster URL.

8. Set the **Namespace**.
+
In our case, this is `daytrader7`, which will be created because we selected the **Auto-Create Namespace** option.


9. After verifying these options, click **Create**.
+
This creates an "Application" resource that ArgoCD uses to watch the repository we gave it.


[#manually_sync]
=== Manually Syncing your Application with the Repository

Since we chose a manual sync policy, we must sync the application manually for ArgoCD to deploy it. On the main page of the ArgoCD console, you should see a new tile that looks like this:

[.img_border_light]
image::/img/blog/configuration-drift-5.png[Argo Dashboard,width=70%,align="center"]

Click the **Sync** button. Then, on the window that appears, click **Sync** again.
To monitor the progress of this application sync, you can click the **daytrader7** tile.
Over the course of a few minutes, you should see resources being created and the app dashboard should look like this:

[.img_border_light]
image::/img/blog/configuration-drift-6.png[App deploying,width=70%,align="center"]

This diagram shows the many Kubernetes resources that are created for the application, such as the deployment, pod, and service. We can also monitor the health of each of these resources and verify that they were created properly.


Now that the application is deployed and all the resources are created we need to make sure it is exposed externally. This sample sets `spec.expose` to `true`, which automatically creates an external route on Red Hat OpenShift. If you are on Kubernetes, you need to either configure a load balancer or an Ingress controller for the application.

On Red Hat OpenShift, find the URL by running the following command:

[source, console]
----
oc get routes –n daytrader7
----

Alternatively, if you are on Kubernetes with Ingress configured, run the following command:

[source, console]
----
kubectl get ingress -n daytrader7
----

Then, paste the URL in a browser to access the Daytrader login page.

And there we go! We have fully deployed our application with GitOps!

[.img_border_light]
image::/img/blog/configuration-drift-7.png[Daytrader Home,width=70%,align="center"]

[#gitops_solve_config_drift]
== How GitOps solves configuration drift

Now that we have deployed the app, let's show a scenario where configuration drift occurs and how we can easily correct it.

Let's say a developer changes the memory settings in the configuration file for a quick test. To represent this, change the memory request that is found at `spec.resources.requests.memory` from 1024Mi to 2048Mi. To make this change, you can either use the console or run the following Kubernetes CLI command:

[source,console]
----
kubectl edit OpenLibertyApplication -n daytrader7 daytrader7
----

In a few moments the argo console should show it is out of sync:

[.img_border_light]
image::/img/blog/configuration-drift-outofsync.png[Daytrader Home,width=70%,align="center"]

"Out of Sync" means that some form of configuration drift occurred in the application. We can refer to the application in the ArgoCD UI to see exactly where it occurred.
Since we set the sync policy to manual, we must manually tell ArgoCD to correct the configuration drift. Click the `Sync` button to return the configuration to match what is in Git.

[.img_border_light]
image::/img/blog/configuration-drift-synced.png[Daytrader Home,width=70%,align="center"]

== Results
In this blog post, we explored the seamless deployment of an Open Liberty application through the GitOps methodology, highlighting its effectiveness in mitigating configuration drift. Whether you're seeking to refine your deployment strategy or embark on a fresh project for an Open Liberty application, we encourage experimenting with GitOps. You can easily extend this approach to automate the deployment of other application dependencies, such as databases.

And for those looking to create or update Open Liberty applications, the link:{url-prefix}/guides/[Open Liberty guides] offer helpful insights and steps.