Deploy a Demo App Tutorial

Learn how to deploy a demo app to a Kubernetes cluster using Armory Continuous Deployment-as-a-Service.

Objectives

In this tutorial, you configure your Kubernetes environment for the demo app and then deploy to multiple environments using Armory CD-as-a-Service.

Before you begin

1. Fork and clone the repo

Fork and then clone the demo repo to the machine where you installed kubectl and the armory CLI.

The demo deploys the following:

  • A simple microservice called Potato Facts, which has an API for facts about potatoes; Armory engineers created this app for demo purposes only.
  • A Potato Facts load balancer
  • Prometheus

In the configuration directory is a setup.sh script that sets up your Kubernetes infrastructure and connects it to Armory CD-as-a-Service.

2. Create credentials

Create a new set of credentials for the demo Remote Network Agents. Name the credentials “demo-app”.

  1. Access the CD-as-a-Service Console.

  2. Go to the Configuration tab.

  3. If you have more than one tenant, make sure you select the desired tenant in the User drop down menu.

  4. In the left navigation menu, select Access Management > Client Credentials.

  5. In the upper right corner, select New Credential.

  6. Create a credential for your RNA. Use a descriptive name for the credential that matches what it is being used for. For example, name the credentials the same as the account name you assigned the target deployment cluster if creating a credential for an Remote Network Agent (RNA).

  7. Set the permission scope to a preconfigured scope group or manually assign permissions. If the credential is for a RNA, select Remote Network Agent from the preconfigured scope group. The group assigns the minimum set of required permissions for a RNA to work:

    • write:infra:data
    • get:infra:op
    • connect:agentHub

    Removing a preconfigured scope group does not remove the permissions that a preconfigured scope group assigns. You must remove the permissions manually.

  8. Note both the Client ID and Client Secret. You need these values when configuring the RNA or any other service that you want to grant access to. Make sure to store the secret somewhere safe. You are not shown the value again.

3. Set up the demo environments in Kubernetes

  1. Make sure you are connected to the Kubernetes cluster you want to install the demo app on.

  2. Log into your Armory CD-as-a-Service environment using the CLI:

    armory login --envName "<envName>"
    

    --envName <envName is optional. Replace <envName> with the name of your Armory CD-as-a-Service environment if you have access to multiple environments.

  3. Navigate to the docs-cdaas-demo directory and run the setup script using the “demo app” credentials you created for this tutorial.

    bash configuration/setup.sh <client-ID> <client-secret>
    

    After the script completes successfully, you can view the connected Remote Network Agents on the CD-as-a-Service Console’s Networking > Agents screen.

4. Add Prometheus integration

In the CD-as-a-Service Console, navigate to Configuration > Canary Analysis > Integrations. Add a new Integration with the following information:

  • Type: Prometheus
  • Name: Demo-Prometheus
  • Base URL: http://prometheus-kube-prometheus-prometheus.demo-infra:9090/
  • Remote Network Agent: demo-prod-us-cluster
  • Authentication Type: None

5. Deploy the demo app

The deployment file is called deploy.yml. From the docs-cdaas-demo directory, run:

armory deploy start -f deploy.yml

Output is similar to:

[2022-04-27T16:24:04-05:00] Deployment ID: 4be2228f-5c46-4574-ad9a-e70e601d94c4
[2022-04-27T16:24:04-05:00] See the deployment status UI:
https://console.cloud.armory.io/deployments/pipeline/4be2228f-5c46-4574-ad9a-e70e601d94c4?environmentId=a8906e61-2388-4daa-b38e-4339390b9447

You can check deployment status by accessing the URL included in the output.

Deployment to prod-us and prod-eu requires manual approval, so be sure to approve in the UI.

Tear down

You can run the destroy.sh script to uninstall Prometheus and the Remote Network Agents. This script also deletes the Kubernetes namespaces created by the setup.sh script.

Troubleshooting

Deployment times out

Because Armory CD-as-a-Service deploys to 100% of nodes on initial deployment, you may run out of space. Increasing the number of nodes should solve the issue.

What’s next



Last modified May 29, 2022: (975089c)