A minishift openshift cluster can be created with cluster metrics installed. Although I couldn't find a way to add metrics to an already created minishift VM instance, the steps below helped to get a new instance up and running easily.
Create a fresh minishift VM with an openshift cluster using the below command. The --metrics parameter is the only additional thing I had to provide for minishift to start installing cluster metrics and Hawkular.
$minishift start —metrics
Once minishift startup completes, you will see the following log message on screen.
-- Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://192.168.64.2:8443
The metrics service is available at:
https://metrics-openshift-infra.192.168.64.2.nip.io
You are logged in as:
User: developer
Password: developer
To login as administrator:
oc login -u system:admin
Note the metrics URL listed after the Openshift console URL. This indicates a successful initiation of cluster metrics and Hawkular.
However, depending on the speed of your Internet connection and the power of your local machine, it can be a while before you can actually browse to the above URL and see the Hawkular information page.
Hawkular metrics pods will be deployed within the openshift-infra project. Run the following commands to keep track of pod creation progress.
Login as cluster admin
$oc login -u system:admin
List all pods in the openshift-infra project
$oc get pods -n openshift-infra
You should see the following metrics pods running.
NAME READY STATUS RESTARTS AGE
hawkular-cassandra-1-zbwkg 1/1 Running 0 42m
hawkular-metrics-zf58x 1/1 Running 0 42m
heapster-x3iqg 1/1 Running 0 42m
metrics-deployer-pod 0/1 Error 0 53m <— This is the deployer pod. Not required to be Running.
As you can see from the table above, it took approximately 42 minutes for the first 3 pods to pull their respective Docker images and eventually reach a running state. The 4th pod is the one orchestrating the installation. It errors out due to a verification script waiting too long. But this did not affect the metrics installation or runtime.
I used the following command to confirm the state of the metrics-deployer-pod
$oc logs -f metrics-deployer-pod
If you look at the last log output from the command above, you will see something similar to that of below. It looks like the long running script times out while waiting for other pods to report a successful deployment. I don't think this breaks the metrics installation, as the 3 pods that makes up Hawkular metrics eventually reaches a running state.
--- validate_deployment_artifacts ---
======== ERROR =========
validate_deployment_artifacts:
Pod hawkular-cassandra-1-zbwkg from ReplicationController hawkular-cassandra-1 is in a Pending state.
This is most often due to waiting for the container image to pull and should eventually resolve.
* * * *
Pod hawkular-metrics-zf58x from ReplicationController hawkular-metrics is in a Pending state.
This is most often due to waiting for the container image to pull and should eventually resolve.
* * * *
Pod heapster-x3iqg from ReplicationController heapster specified an image that cannot be pulled.
ERROR: This is most often due to the image name being wrong or the docker registry being unavailable.
Ensure that you used the correct IMAGE_PREFIX and IMAGE_VERSION with the deployment.
There was an event for this pod with the following message:
Failed to pull image "openshift/origin-metrics-heapster:v1.4.1": net/http: request canceled
* * * *
========================
--- validate_deployed_project ---
VALIDATION FAILED
When the first 3 pods are running and ready, you should be able to browse to https://metrics-openshift-infra.192.168.64.2.nip.io (IP will be different) and see a page similar to that of the screenshot hawkular-metrics-installed.png
After confirming above, you can login to your Openshift console and create a sample application. I used my Django example from one of my previous gists at https://gist.github.com/tyrell/8552a8761d98a67f9dbb1d808df35734 for this purpose.
When your application is initialised, you will see a new metrics sections in the pod overview (hawkular-metrics-installed-pod-metrics-overview.png) and also a new tab in the pod details page (hawkular-metrics-installed-pod-metrics-detail.png).
- I noted that minishift has mentioned metrics as an experimental feature. So it may be flaky.
- Metrics storage seems to be in-memory and not persisted.
- I didn't see any numbers appear in the metrics UI sections mentioned above. This may be due to a number of reasons. But from a proof of concept perspective, I was happy with what I ended up with after Step 3.
- I will have to get metrics recording fixed in order to experiment with Grafana http://www.hawkular.org/blog/2016/10/24/hawkular-metrics-openshift-and-grafana.html. But that's for another day.
- https://minishift.io/docs/minishift_start.html
- https://github.com/openshift/origin-metrics
- https://docs.openshift.org/latest/install_config/cluster_metrics.html
Copyright (c) 2017 Tyrell Perera [email protected] Licensed under the MIT license.
Did you mean
$minishift start --metrics
in the first snippet as opposed to$minishift start —metrics
? (looks like the two dashes got formatted into one m-dash) Otherwise thanks for the great resource!