Skip to main content

Installing Hawkular Cluster Metrics

Hands-On Lab

 

Length

01:00:00

Difficulty

Advanced

You are tasked with installing Hawkular cluster metrics on the OpenShift cluster using the Ansible playbook located at /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml. Before installing Hawkular Metrics, create a 10 GB PersistentVolume named cassandra-data that will be used with Cassandra storage.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Installing Hawkular Cluster Metrics

Introduction

You are tasked with installing Hawkular Metrics on the OpenShift cluster using the Ansible playbook located at /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml. Before installing the cluster metrics, we must create a 10 GB PersistentVolume named cassandra-data that will be used with Cassandra storage.

Solution

  • Log in to the OpenShift cluster using the credentials provided on the hands-on lab page:

    ssh cloud_user@<IP_ADDRESS>
  • Become the root user:

    sudo -i
  • Check the health of the cluster:

    oc get nodes
  • Switch the openshift-infra project:

    oc project openshift-infra
  • Create a YAML file for our first PersistentVolume: > Note: We need two volumes. If we create just one, the openshift-ansible-service-broker has a tendency to bond with the first volume created.

    vim cassandra-data.yml
  • Paste the following into this file:

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: cassandra-data
    spec:
      capacity:
        storage: 5Gi
      accessModes:
      - ReadWriteOnce
      nfs:
        path: /home/data/persistent03
        server: ip-10-0-2-206.ec2.internal
      persistentVolumeReclaimPolicy: Recycle
  • Save and close the file:

    :wq
  • Create a YAML file for our second PersistentVolume:

    vim cassandra-storage.yml
  • Paste the following into this file:

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: cassandra-storage
    spec:
      capacity:
        storage: 5Gi
      accessModes:
      - ReadWriteOnce
      nfs:
        path: /home/data/persistent03
        server: ip-10-0-2-206.ec2.internal
      persistentVolumeReclaimPolicy: Recycle
  • Save and close the file:

    :wq
  • Create the PersistentVolume:

    oc create -f cassandra-data.yml
    oc create -f cassandra-storage.yml
  • Verify our PersistentVolume:

    oc get pv
  • Edit the ansible inventory file:

    vim /etc/ansible/hosts
  • Add the requested settings for our Hawkular Metrics configuration:

    > Note: The following should be added under the last line of the [OSEv3:vars] section.

    # Hawkular Metrics settings
    openshift_metrics_install_metrics=True
    openshift_metrics_hawkular_hostname=hawkular-metrics-openshift-infra.10.0.2.204.xip.io
    openshift_metrics_cassandra_storage_type=pv
    openshift_metrics_hawkular_limits_cpu=200m
    openshift_metrics_hawkular_requests_cpu=200m
    openshift_metrics_hawkular_requests_memory=1Gi
    openshift_metrics_heapster_limits_memory=1Gi
    openshift_metrics_heapster_requests_memory=1Gi
    openshift_metrics_hawkular_nodeselector={"region":"infra"}
    openshift_metrics_heapster_nodeselector={"region":"infra"}
    openshift_metrics_cassandra_nodeselector={"region":"infra"}
    openshift_metrics_image_version=v3.9
  • Save and close the file:

    :wq
  • Install Hawkular Metrics:

    > Note: This can take up to 10 minutes to complete.

    ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml
  • Verify pods:

    > Note: It may take up to 15 minutes for all of the pods to show as Running.

    oc get pods
  • Show the Hawkular endpoint:

    oc get routes
  • View our Hawkular endpoint:

    > Note: We will use the "display insecure connections" option with curl because we are using self-signed certificates.

    curl -k https://hawkular-metrics-openshift-infra.10.0.2.204.xip.io

Conclusion

Congratulations, you've completed this hands-on lab!