Published on
Exercise 7

Optional - Deploying an application via gitops

Authors
  • Name
    Twitter

Now that you've had a taste of most of the more basic deployment methods let's introduce the concept of GitOps and deploy an application using this more advanced approach.

In simple terms GitOps uses Git repositories as a single source of truth to deliver applications or infrastructure as code. Whenever you merge or push code into a specifc Git branch in a repository, an GitOps continuous delivery tool such as ArgoCD can then automatically sync that to one or more Kubernetes clusters.

|argocd | |:-------------------------------------------------------------------:| | ArgoCD user interface |

For many organisations GitOps is a goal deployment methodology as application definitions, configurations, and environments should ideally be declarative and version controlled. Application deployment and lifecycle management should be automated, auditable, and easy to understand.

Since 2021 OpenShift has included a fully supported OpenShift GitOps operator, based on the upstream ArgoCD project.

This operator has already been installed on your cluster so let's take it for a spin now! 🚀

7.1 - Deploy openshift gitops

To get started with OpenShift GitOps we will need an instance of ArgoCD deployed.

Click the + button in the top right corner menu bar of the OpenShift web console. This is a fast way to quickly import snippets of YAML for testing or exploration purposes.

Paste the below snippet of YAML into the editor and replace the instance of userX with your assigned user.

Click Create. In a minute or so you should see the ArgoCD instance running successfully in your project.

apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
  finalizers:
  - argoproj.io/finalizer
  name: argocd
  namespace: userX
spec:
  rbac:
    defaultPolicy: role:admin
    scopes: '[groups]' 
  server:
    route:
      enabled: true
  sso:
    dex:
      openShiftOAuth: true
    provider: dex

7.2 Login to argocd

With ArgoCD running let's open the route in a new tab in our browser and click Log in with OpenShift. You can retrieve the ~Route~ by running the following command in your web terminal:

oc get route argocd-server

|argocd login | |:-------------------------------------------------------------------:| | ArgoCD login |

7.3 Deploy an application

Now that you're logged into ArgoCD, have a go at creating a new Application using the ArgoCD web interface by clicking + New App. The workload we'll deploy is a new mission critical training simulator called "Quake 3 Arena".

Use the following values for your Application:

|Field|Value| |-----|-----| |Name |quake| |Project|default| |Repository URL|https://github.com/jmhbnz/workshops| |Path|data/app-delivery| |Cluster URL| https://kubernetes.default.svc| |Namespace|userX|

7.4 Access the mission critical simulator - challenge

Your final challenge for this exercise is to access the mission critical training simulator by creating a Route.