Skip to main content

Deploying applications

We have successfully configured Argo CD App of Apps, so now we can deploy an environment specific customization for the set of application.

First let's remove the existing Applications so we can replace it:

~$kubectl delete -k ~/environment/eks-workshop/base-application --ignore-not-found=true
namespace "assets" deleted
namespace "carts" deleted
namespace "catalog" deleted
namespace "checkout" deleted
namespace "orders" deleted
namespace "other" deleted
namespace "rabbitmq" deleted
namespace "ui" deleted
...

We will then need to create a customization for each application:

.
|-- app-of-apps
| |-- ...
`-- apps-kustomization
|-- assets
| `-- kustomization.yaml
|-- carts
| `-- kustomization.yaml
|-- catalog
| `-- kustomization.yaml
|-- checkout
| `-- kustomization.yaml
|-- orders
| `-- kustomization.yaml
|-- other
| `-- kustomization.yaml
|-- rabbitmq
| `-- kustomization.yaml
`-- ui
|-- deployment-patch.yaml
`-- kustomization.yaml
~/environment/eks-workshop/modules/automation/gitops/argocd/apps-kustomization/ui/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://github.com/aws-samples/eks-workshop-v2/manifests/base-application/ui?ref=stable
patches:
- path: deployment-patch.yaml

We define a path to base Kubernetes manifests for an application, in this case ui, using resources. We also define which configuration should be applied to ui application in EKS cluster using patches.

~/environment/eks-workshop/modules/automation/gitops/argocd/apps-kustomization/ui/deployment-patch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: ui
spec:
replicas: 1

We would like to have 1 replica for ui application. All other application will use configuration from base Kubernetes manifests.

Copy files to the Git repository directory:

~$cp -R ~/environment/eks-workshop/modules/automation/gitops/argocd/apps-kustomization ~/environment/argocd/

Your final Git directory should now look like this. You can validate it by running tree ~/environment/argocd:

|-- app-of-apps
| |-- Chart.yaml
| |-- templates
| | |-- _application.yaml
| | `-- application.yaml
| `-- values.yaml
|-- apps
| ...
`-- apps-kustomization
|-- assets
| `-- kustomization.yaml
|-- carts
| `-- kustomization.yaml
|-- catalog
| `-- kustomization.yaml
|-- checkout
| `-- kustomization.yaml
|-- orders
| `-- kustomization.yaml
|-- other
| `-- kustomization.yaml
|-- rabbitmq
| `-- kustomization.yaml
`-- ui
|-- deployment-patch.yaml
`-- kustomization.yaml

12 directories, 19 files

Push changes to the Git repository:

~$git -C ~/environment/argocd add .
~$git -C ~/environment/argocd commit -am "Adding apps kustomization"
~$git -C ~/environment/argocd push

Click Refresh and Sync in ArgoCD UI, use argocd CLI to Sync the application or wait until automatic Sync will be finished:

~$argocd app sync apps
~$argocd app sync ui

We've now successfully migrated the all the applications to deploy using Argo CD, and any further changes pushed to the Git repository will be automatically reconciled to EKS cluster.

When Argo CD finish the sync, all our applications will be in Synced state.

argocd-ui-apps.png

You should also have all the resources related to the ui application deployed. To verify, run the following commands:

~$kubectl get deployment -n ui ui
NAME   READY   UP-TO-DATE   AVAILABLE   AGE
ui     1/1     1            1           61s
~$kubectl get pod -n ui
NAME                 READY   STATUS   RESTARTS   AGE
ui-6d5bb7b95-rjfxd   1/1     Running  0          62s

argocd-deploy-application