Manage your datacenter with HCP management plane
In the previous tutorial you learned how to monitor an existing Consul service mesh datacenter using the Grafana monitoring suite.
This tutorial describes the process for linking your on-premises Consul datacenter to HCP Consul Central, the hosted management plane service available to organizations using HCP Consul.
HCP Consul Central provides a GUI interface that centralizes global management operations across Consul clusters. It enables global visibility and control for both HashiCorp-managed and self-managed Consul datacenters, even when you deploy services in different cloud environments and regions.
During the linking process, HCP deploys a telemetry collector enables observability by visualizing server and envoy metrics directly in the HCP Portal.
In this tutorial, you will use a test environment to:
- Create a link to a self-managed Consul cluster using the HCP interface.
- Apply the configuration secrets to your Consul servers that HCP requires for the linking process..
- Verify the linked datacenter is accessible directly from the HCP Portal.
- Use HCP Consul Central to monitor your Consul datacenter's status.
Prerequisites
For this tutorial you will need:
- An HCP account.
- A Consul datacenter with Consul service mesh configured.
If you completed the previous tutorial, the infrastructure you already have in place meets all of the prerequisites.
Login into the bastion host VM
Login to the bastion host using ssh
.
Link the Consul datacenter to HCP
To link a self-managed Consul datacenter to your HCP management plane service, complete the following steps:
- Create the link configuration in HCP.
- Modify Consul servers configuration to include HCP link information.
- Restart Consul server nodes.
Create link configuration in HCP
After the Consul datacenter is deployed, login to HashiCorp Cloud Platform.
From the HCP dashboard select a project or create a new one.
From the project, select Get started with Consul.
Select Self-managed Consul in the Consul cluster type and Link existing in the linking method. When ready click on Get Started.
On the next screen, decide the Consul cluster name. In the example, the name is linked-self-hosted. Then select Virtual machine as the runtime type. When ready click on Continue.
HCP provides a custom Consul configuration that you can copy and paste to add to your Consul server's configuration. Do not close the page containing this configuration. The page changes automatically once the link is established.
Link Consul datacenter
Login to the VM for the Consul server.
Copy the Consul configuration generated by HCP into a file inside the Consul configuration directory.
In the test scenario, the Consul configuration directory is /etc/consul.d
.
Stop the Consul process.
Restart the Consul process to include the path to the new configuration.
The command starts the Consul server in the background so that it does not lock the terminal. You can access the
Consul server log through the /tmp/consul-server.log
file.
Verify linking from HCP web interface
After the linking process is complete, HCP Consul displays the cluster details page for your self-managed cluster.
When you click the Access Consul button, you can access your Consul datacenter's UI directly through HCP.
You may notice that you are automatically logged into Consul. HCP provides access to the Consul UI by automatically injecting a management token into the Consul datacenter.
Use HCP to monitor your Consul datacenter
The linking process automatically configures Consul servers so that they send telemetry information to the HCP management plane service.
Click the Observability link in the sidebar.
Verify that metrics, relative to your Consul datacenter, are being populated in HCP's web interface.
Unlink the datacenter
Once you complete this tutorial, you can unlink the datacenter from the HCP UI.
Click the Manage button and then Unlink.
On the next screen, confirm that you want to unlink the cluster by writing UNLINK
in the text box.
Then click the Unlink button.
Destroy the infrastructure
Now that the tutorial is complete, you should clean up the infrastructure you created.
From the ./self-managed/infrastruture/aws
folder of the repository, use
terraform
to destroy the infrastructure.
Next steps
In this tutorial you learned how to link an existing self-hosted Consul datacenter to HCP management plane service and to access Consul UI and monitor your datacenter telemetry metrics directly from the HCP web interface.
If you want to read more about HCP management plane service, refer to the Management plane overview documentation.
If you want to know more about the available observability metrics provided by the HCP management plane service, refer to the Consul Observability documentation.
If you want to learn more on how to use HCP Consul as control plane for your datacenter, refer to the Get started with HCP Consul tutorial collection.