Creating shared resources

This section outlines how to create the required resources within an Azure subscription. If some resources are already created, ensure that the environment is correctly configured to point to them, and skip their creation in the respective subsection below.

Before you begin, make sure that you downloaded and extracted the Anjuna Kubernetes Toolset installer bundle as shown in Downloading the Anjuna Kubernetes Toolset.

Make sure that the ${WORKSPACE} environment variable is correctly set to the path of the directory that contains the extracted installer bundle, and then run the following command to change to this directory:

$ cd "${WORKSPACE}"

Within the installer bundle’s iac/azure folder, you will find two Terraform modules, shared and cluster. These modules are used to create, update, and delete the cloud resources needed to deploy the Anjuna Kubernetes Toolset to a cluster.

The two modules are responsible for the following types of resources:

  • Shared: resources that can be shared across multiple clusters

  • Cluster: resources that are specific to a cluster

For this guide, the shared module will be used to manage the following resources:

  • Resource group

  • Shared Image Gallery

  • Shared image definition

  • Azure Storage Account

The following resource is also needed but not currently managed by the provided Terraform scripts:

  • Service Principal: the Anjuna Cloud Adaptor also requires a Service Principal (with at least a "Contributor" role) to manage VMs.

On the previous page, Creating cloud service provider credentials, you created the Service Principal manually and exported the credentials to your CLI environment. You must do this before proceeding with the installation.

Create resources

Each Terraform module defines an env.sh script that can be sourced to configure your environment. In case you already have the resources created, you can examine the env.sh script to determine how to set environment variables to use your existing resources.

Use the following commands to create the shared resources needed to deploy the Anjuna Kubernetes Toolset to your cluster.

First, create a new terraform.tfvars file with your desired configuration, such as the Azure region where resources should be deployed to. When picking a region, make sure that it supports the needed VM instance sizes (e.g., DCasv5 and DCadsv5-series).

$ cat <<EOF > ${WORKSPACE}/iac/azure/shared/terraform.tfvars
# Region where resources should be provisioned in Azure
location = "eastus"

# Identifier to be prepended to all resource names
prefix = "anjunaakssev"

# Tags to use on the resources deployed with this configuration
tags = {}
EOF

To create the shared resources, run:

$ terraform -chdir=${WORKSPACE}/iac/azure/shared init
$ terraform -chdir=${WORKSPACE}/iac/azure/shared apply

You will be prompted to approve the creation of the resources.

After Terraform runs successfully, configure your environment to use the newly created resources:

$ source ${WORKSPACE}/iac/azure/shared/env.sh