Environments represent one or more of your deployment infrastructures, such as Dev, QA, Stage, Production, etc.
Once you've added a Service to your Application, you can define Environments where your Service can be deployed. In an Environment, you specify the following:
- A Harness Service, such as a Service with a Docker image artifact you configured.
- A deployment type, such as Kubernetes.
- A Cloud Provider, such as a Kubernetes cluster or Google Cloud Platform that you added in Add Cloud Providers.
An Environment can be a Dev, QA, Production, or other environment. You can deploy one or many services to each Environment.
Before You Begin
Add an Environment
The following procedure creates an Environment for a single Service.
To add an environment, do the following:
- Click Setup.
- Click an Application.
- Click Environments.
- Click Add Environment. The Environment dialog appears.
- Enter a name and description for the Environment. For example, the name DEV with the description, This is the development environment for example.com.
- In Environment Type, choose Production or Non-Production.
- Click SUBMIT. The Environment Overview appears. Here you can add the Service Infrastructure and overrides to the configurations of the Services that use this Environment.
Add a Service Infrastructure
The Service Infrastructure for an Environment is where you specify a deployment infrastructure, using a Cloud Provider you added in Add Cloud Providers, a deployment type, such Kubernetes, and the specific infrastructure details for the deployment, like VPC settings.
To add a Service Infrastructure, do the following:
- In an Application, open an Environment.
- In Service Infrastructure, click Add Service Infrastructure. The Service Infrastructure dialog appears.
- In Service, click the name of the Service that will deploy to this Environment.
- In Deployment Type, click a deployment type such as Kubernetes.
- In Cloud Provider, click the cloud provider where you will deploy the service.
- Click Next. Harness will retrieve the cluster information from the cloud provider you selected.
- In Cluster Name, click the name of the cluster where you want to deploy the service.
- In Namespace, select the name of the cluster namespace.
- Click SUBMIT. The infrastructure is listed under Service Infrastructure.
For some Service Infrastructures, you will need to select VPC details and enter Connection Attributes. Connection Attributes are SSH keys used to connect to hosts in the VPC. This authentication is different from that performed by the Cloud Provider you select, which is used for API communication.
Connection Attributes use SSH keys set up in Harness Secrets. For more information, see Secrets Management.
Override a Service Configuration
You can configure your Environment to override settings of the Services that use the Environment. For example, a Service might use a specific values.yaml file, but your Environment might need to change the name and namespace of the Deployment object because it is deploying the Service to a QA Environment.
To override a Service configuration, do the following:
- In an Application, open an Environment.
- Click Add Configuration Overrides. The Service Configuration Override dialog appears.
- In Service, click the name of the Service you want to override. Depending on the type of Service you select, the Override Type options will be different. Here is an example of the options available when a Service with Kubernetes type is used.
- Click an Override Type option.
- Enter the override and click SUBMIT.
24x7 Service Guard
24x7 Service Guard applies Harness Continuous Verification unsupervised machine-learning to detect regressions and anomalies across transactions and events for the service and displays the results in the 24x7 Service Guard dashboard.
For more information, see 24x7 Service Guard.
The most common error with environments occurs when an environment's connection to a workflow is changed in such a way as to render it inoperable for a deployment of that workflow. The error is displayed in the Workflows and Continuous Deployment pages:
This error can occur in the following circumstances:
- A user changes the environment service infrastructure. For example, the user might remove a service infrastructure or change its Deployment Type or Cloud Provider so that the workflow can no longer use the environment to deploy its service(s).
- A user changes the environment in a workflow. If you open the Workflow dialog and, in Environment, you select a different environment, then a service infrastructure must also be selected in Service Infrastructure.
- The user clones a workflow to a different application that uses services that cannot deploy to the service infrastructure in that environment.
As a result of these changes, the workflow has no functional service infrastructure specified, and you must select a new service infrastructure for each impacted workflow/phase.