3 - Define Your AKS Target Infrastructure
Once you've added a Service to your Application, you can define Environments where your Service can be deployed.
Create a New Harness Environment
In an Environment, you specify the following:
- A Harness Service, such as the Service with a Docker image artifact you configured.
- A Cloud Provider, such as the Kubernetes Cluster Cloud Provider that you added in Cloud Providers Setup.
An Environment can be a Dev, QA, Production, or other environment. You can deploy one or many Services to each Environment.
The following procedure creates an Environment for the Service we set up earlier.
- In your Harness Application, click Environments. The Environments page appears.
- Click Add Environment. The Environment dialog appears.
- In Name, enter a name that describes the deployment environment, for example, AKS.
- In Environment Type, select Non-Production.
- Click SUBMIT. The new Environment page appears.
Add an Infrastructure Definition
Infrastructure Definitions specify the target deployment infrastructure for your Harness Services, and the specific infrastructure details for the deployment, like VPC settings.
To add the Infrastructure Definition, do the following:
- In the Harness Environment, click Add Infrastructure Definition. The Infrastructure Definition dialog appears.
- In Name, enter the name you will to select this Infrastructure Definition when you create a Workflow.
- In Cloud Provider Type, select Kubernetes Cluster.
- In Deployment Type, select Kubernetes.
- Click Use Already Provisioned Infrastructure. If you were using a Harness Infrastructure Provisioner, you would select Map Dynamically Provisioned Infrastructure.
- In Cloud Provider, select the Cloud Provider you added earlier. Ensure that you select the Kubernetes Cluster Cloud Provider you set up for the AKS connection and not the Azure Cloud Provider you set up for the ACR connection.
- In Namespace, enter the name of the cluster namespace you want to use. As we noted in Namespace Variable, you can enter any value here and the Service will use it in its Namespace manifest to create the namespace at runtime.
- In Release Name, you can see the expression Harness uses for tracking a release. The release name must be unique across the cluster. The Harness-generated unique identifier
${infra.kubernetes.infraId}
can be used as a suffix to ensure a unique release name. - In Scope to specific Services, select the Harness Service you created earlier.
- Click Submit.
That is all you have to do to set up the deployment Environment in Harness.
Now that you have the Service and Environment set up. Now you can create the deployment Workflow in Harness.