OpenShift Origin 3.9部署Hawkular Metrics后无法访问的问题求助
Let’s work through your issue step by step—your immediate error (could not resolve host:hawkular-metrics.example.com) points to a DNS resolution problem, but we’ll also cover other potential pitfalls specific to OpenShift 3.9 Metrics.
1. Fix DNS Resolution First
The core problem right now is that the machine running your curl command can’t translate hawkular-metrics.example.com to an IP address. Here’s how to resolve this:
- Test DNS lookup directly with these commands:
nslookup hawkular-metrics.example.com # or dig hawkular-metrics.example.com - If the lookup fails, choose one of these fixes:
- Local hosts file entry: Add a line to
/etc/hosts(Linux/macOS) orC:\Windows\System32\drivers\etc\hosts(Windows) mapping the hostname to your OpenShift router’s public IP. Example:192.168.1.100 hawkular-metrics.example.com - DNS server configuration: Add an A record for
hawkular-metrics.example.comin your organization’s DNS server, pointing to the OpenShift router’s public IP.
- Local hosts file entry: Add a line to
2. Verify OpenShift Metrics Route Configuration
Even with fixed DNS, you need to confirm the route for Hawkular Metrics exists and is properly set up:
- Run this command to check routes in the metrics project:
oc get routes -n openshift-infra - Look for a route named
hawkular-metricswith the hostnamehawkular-metrics.example.comand aReadystatus. If the route is missing, re-run the metrics installer playbook (your inventory parameters should trigger route creation automatically).
3. Fix Typos in Your Curl Command
Your curl command has two critical typos that will cause failures even after fixing DNS:
Athorizationshould beAuthorization(missing a 'u')- The final path segment is
meticsinstead ofmetrics(extra 'e')
Here’s the corrected command:
curl -H "Authorization: Bearer XXXXX" -H "Hawkular-Tenant:openshift-infra" -X GET https://hawkular-metrics.example.com/hawkular/metrics/metrics
If you’re using a self-signed certificate (common in test environments), add the -k flag to skip SSL verification:
curl -k -H "Authorization: Bearer XXXXX" -H "Hawkular-Tenant:openshift-infra" -X GET https://hawkular-metrics.example.com/hawkular/metrics/metrics
4. OpenShift 3.9 Metrics Additional Checks
For OpenShift Origin 3.9, these extra checks will help rule out edge cases:
- Router Pod Health: Ensure the OpenShift router is running to forward traffic to the metrics route:
Look for a router pod withoc get pods -n defaultRunningstatus. - Token Permissions: Verify your bearer token has sufficient permissions to access metrics. Using a cluster-admin token is the easiest way to eliminate permission-related issues.
- Metrics Pod Logs: You mentioned
hawkular-cassandra,hawkular-metrics, andheapsterare running—if you still hit issues after fixing DNS/typos, check the hawkular-metrics pod logs for errors:oc logs <hawkular-metrics-pod-name> -n openshift-infra
内容的提问来源于stack exchange,提问作者JOY

