You need to enable JavaScript to run this app.
Volcengine Managed Service for Prometheus

Volcengine Managed Service for Prometheus

Copy page
Download PDF
Accessing workspaces across clouds and across regions
Accessing a workspace over the Internet through a proxy
Copy page
Download PDF
Accessing a workspace over the Internet through a proxy
The workspace of Volcengine Managed Service for Prometheus (VMP) can be accessed over the Internet through a proxy. This topic describes how to create a proxy in a Volcengine Kubernetes Engine (VKE) cluster to access a workspace over the Internet.​
Background​
A VMP workspace offers a standard remote write URL and a standard query URL that can be accessed over internal networks. This allows you to collect service metrics and business metrics in the internal networks of the public cloud and deploy Grafana in a VKE cluster to create and view metric dashboards. For more details, see Deploying Grafana and connecting to a workspace in the VKE cluster.​
In some scenarios, you may need to access the data of a VMP workspace over the Internet. For example, in multi-cloud scenarios, you need to aggregate data from multiple public clouds to Grafana for centralized viewing. In this case, you can configure a proxy in a VKE cluster to access the VMP workspace over the Internet.​
Prerequisites​
  • A VMP workspace has been created, and basic authentication has been enabled. For details, see Creating workspaces.​
  • The ingress-nginx agent or a self-built NGINX Ingress is installed in the cluster, and the corresponding Classic Load Balancer (CLB) instance is configured.​
  • If you use the ingress-nginx agent, you need to configure the corresponding CLB instance based on your business requirements when you install the agent. For example, set the Load Balancing type parameter to Public network, and set the Billing method parameter to Pay-as-you-go - by bandwidth limit or Pay-as-you-go - by actual traffic based on your business requirements. For more details, refer to the ingress-nginx section of the Installing an add-on topic.​
Procedure​
Step 1: Configure the Secret​
To ensure communication security over the Internet, use HTTPS for communication between Grafana and VMP. Therefore, it is necessary to use a Secret to configure the SSL certificate and key used by HTTPS.​
  1. Obtain the SSL certificate and key. This topic takes tls.key and tls.crt as an example.​
  1. Use kubectl to connect to the target cluster and run the following command to create a Secret named grafana-key of type kubernetes.io/tls:​
​
kubectl create secret tls grafana-key --key tls.key --cert tls.crt​
​
Step 2: Configure a service and an Ingress​
  1. In the left navigation bar, click Services and Ingresses > Service. Click Create with Yaml to create a service. You can access the VMP workspace by using a service of type ExternalName.​
​
apiVersion: v1​
kind: Service​
metadata:​
name: vmp-service​
spec:​
externalName: query.prometheus-cn-beijing.ivolces.com # The domain name of the VMP workspace. Domain names of workspaces vary based on different regions.​
ports:​
- name: vmp​
port: 80​
protocol: TCP​
targetPort: 80​
sessionAffinity: None​
type: ExternalName​
​
  1. Click Workload > Resource Explorer in the left navigation pane. Click Create with Yaml to create an Ingress. Specify the mapping relationship between the external domain name and the service.​
  • Select Custom from the Type drop-down menu.​
  • Enter the YAML configuration in the Yamlfield.​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: vmp-ingress​
spec:​
ingressClassName: nginx # The class name of the Ingress controller in the cluster. This field is used to select the Ingress instance.​
rules:​
- host: vmp-test.com # The custom domain name of the VMP workspace that can be accessed over the Internet.​
http:​
paths:​
- backend:​
service:​
name: vmp-service # The service name, which must be consistent with the service configuration.​
port:​
number: 80​
path: /​
pathType: Prefix​
tls:​
- hosts:​
- vmp-test.com # Specify the domain name to be encrypted.​
secretName: grafana-key # Specify the name of the Secret used by the Ingress.​
​
tip​
You need to ensure the DNS resolution relationship between the custom domain name and the public IP address of the CLB instance for the Ingress in the public network environment.​
Step 3: Integrate a workspace data source​
  1. Log in to Grafana in the public network.​
  1. Click Connections > Data sources in the left navigation pane.​
  • ​alt​​
  1. Click Add data source to create a new data source.​
  • ​alt​​
  1. On the Add data source page, click Prometheus.​
  • ​alt​​
  1. In the HTTP section, paste the modified query URL of the workspace in the Prometheus server URL field.​
tip​
You need to modify the original query URL of the workspace as follows:​
  1. Change the protocol to https.​
  1. Replace the domain name with the public domain name configured in the Ingress.​
  1. The values of other parameters remain unchanged.​
For example, change the query URL to https://vmp-test.com/workspaces/1c3***.​
​alt​​
6. Switch on Basic auth in the Auth section and configure the username and password used for workspace authentication in the Basic Auth Details section.​
warning​
If your certificate is a self-signed or other untrusted certificate, you also need to switch on Skip TLS Verify. Otherwise, Grafana will report a certificate verification error.​
​alt​​
7. Click Save & test at the bottom of the page. When the message Successfully queried the Prometheus API is displayed, it indicates the data source is configured and the workspace is integrated with Grafana.​
​alt​​
Step 4: Create and view a dashboard​
  1. Click Dashboards in the left navigation pane.​
  • ​alt​​
  1. Click New to create or import an observability dashboard.​
  • ​alt​​
  1. You can view valid monitoring information by using the dashboard.​
  • ​alt​​
Monitoring and O&M​
The proxy is used to read and write data in the VMP workspace over the Internet. The read or write performance is closely related to the performance of the Ingress instance in the VKE cluster. It is recommended that you use the observability feature of the VKE cluster to monitor and perform O&M on the Ingress instance. You can refer to the following topics:​
References​
Create a self-signed certificate by using OpenSSL​
  1. In the local environment, visit the OpenSSL official website and download and install OpenSSL.​
  1. Run the following command to generate a 2048-bit RSA private key:​
​
openssl genrsa -out tls.key 2048​
​
The following section shows the expected response result.​
​
Generating RSA private key, 2048 bit long modulus​
........+++++​
...+++++​
e is 65537 (0x10001)​
​
  1. Run the following command to use the RSA private key to generate a certificate:​
​
openssl req -new -key tls.key -out tls.csr​
​
The following section displays the expected response. You need to enter information about the certificate, such as the country, region, organization name, domain name, and email address.​
​
You are about to be asked to enter information that will be incorporated​
into your certificate request.​
What you are about to enter is what is called a Distinguished Name or a DN.​
There are quite a few fields but you can leave some blank​
For some fields there will be a default value,​
If you enter '.', the field will be left blank.​
-----​
Country Name (2 letter code) []:CN # The country code, such as CN.​
State or Province Name (full name) []:Shanghai # The region name, such as Shanghai.​
Locality Name (eg, city) []:Shanghai # The city name, such as Shanghai.​
Organization Name (eg, company) []:vke # The organization name.​
Organizational Unit Name (eg, section) []:vke # The unit name in the organization.​
Common Name (eg, fully qualified host name) []:vmp-test.com # The domain name that corresponds to the certificate. Enter vmp-test.com for this example.​
Email Address []:user@example.com # The email address.​
​
Please enter the following 'extra' attributes​
to be sent with your certificate request​
A challenge password []:mypassword # The password, which can be left empty.​
​
  1. Run the following command to sign the certificate with the private key and set the validity period of the signature to 365 days:​
​
openssl x509 -req -in tls.csr -out tls.crt -signkey tls.key -days 365​
​
  1. The private key (tls.key) and certificate (tls.crt) required for HTTPS encryption are created.​
​
Last updated: 2026.10.10 11:04:51