The past is relevant only as data

15 MINUTE PRACTICE

Using Argo CD, GitOps continuous delivery tool for Kubernetes, you will be able to reproduce easily the environment of the Mysterious Apps.

What is Argo CD?

Argo CD Logo

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.

It follows the GitOps pattern of using Git repositories as the source of truth for defining the desired application state.

It automates the deployment of the desired application states in the specified target environments. Application deployments can track updates to branches, tags, or pinned to a specific version of manifests at a Git commit.

Log in to Argo CD

Click on the 'Developer GitOps' button below

Then log in as user%USER_ID%/%OPENSHIFT_PASSWORD%. Once completed, you will be redirected to the following page.

Argo CD - Home Page

Sync/Deploy The GitOps Application

From the Application menu,click on your 'staging-project%USER_ID%' application

Argo CD - Application

The application status is initially in yellow OutOfSync state since the application has yet to be deployed into staging-project%USER_ID% OpenShift project, and no Kubernetes resources have been created.

Argo CD - OutOfSync Application

Now let’s deploy the Coolstore Application into staging-project%USER_ID%.

Click on 'Sync > Synchronize'.

Argo CD - Sync Application

This task retrieves the manifests from the GitOps Repository and performs kubectl apply command of the manifests. Your application is now running. You can now view its resource components, logs, events, and assessed health status.

You should see everything in green.

Argo CD - Synced Application

Controlling Ingress Traffic

The Application deployed is using Istio (covered in the next lab). To be able to access the application from outside of the cluster we have to expose a specific service reachable externally, this service is called Istio Gateway. A Gateway allows Istio features such as monitoring and route rules to be applied to traffic entering the cluster.

To open a '>_ workshop_tools' terminal window in CodeReady Workspaces, click on 'Terminal' → 'Open Terminal in specific container' → 'workshop-tools'

In your Workspace, create the Istio Gateway and its VirtualService by executing the following commands in the '>_ workshop_tools' terminal window

cat <<EOF | oc apply --namespace=staging-project%USER_ID% -f -
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: istio-gateway%USER_ID%
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - "gateway-staging-project%USER_ID%.%APPS_HOSTNAME_SUFFIX%"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: gateway
spec:
  hosts:
    - "gateway-staging-project%USER_ID%.%APPS_HOSTNAME_SUFFIX%"
  gateways:
    - istio-gateway%USER_ID%
  http:
    - route:
        - destination:
            port:
              number: 8080
            host: gateway
EOF

Then use the new OpenShift Route in the Web Service by executing the following commands in the '>_ workshop_tools' terminal window

oc set env deployment/web COOLSTORE_GW_ENDPOINT=http://gateway-staging-project%USER_ID%.%APPS_HOSTNAME_SUFFIX% -n staging-project%USER_ID%

Testing the application

In the OpenShift Web Console, from the Developer view, select the staging-project%USER_ID% to be taken to the project overview page.

OpenShift - Coolstore Project Deployed by Argo CD

You can see that all resources of your application have been created by Argo CD.

Then, click on the 'Open URL' icon of the Web Service.

Your browser will be redirect to your Web Service running on OpenShift. You should be able to see the CoolStore application with all products and their inventory status.

CoolStore Shop

Now, you are now ready to tackle all the problemS!