Operator Metering is a collection of a few components:
- A Metering Operator Pod which aggregates Prometheus data and generates reports based on the collected usage information.
- Hive and Presto clusters, used by the Operator Metering Pod to perform queries on the collected usage data.
Operator Metering requires the following components:
- A Kubernetes v1.8 or newer cluster
- A StorageClass for dynamic volume provisioning. (See configuring metering for more information.)
- A Prometheus installation within the cluster configured to do Kubernetes cluster-monitoring.
- The prometheus-operator repository's kube-prometheus instructions are the standard way of achieving Prometheus cluster-monitoring.
- At a minimum, we require kube-state-metrics, node-exporter, and built-in Kubernetes target metrics.
- Openshift 3.10 or newer includes monitoring via the openshift-montoring playbook.
- 4GB Memory and 2 CPU Cores available cluster capacity.
- At least 1 node with 2GB available memory (the highest memory request for a single Operator Metering Pod)
- Memory and CPU consumption may often be lower, but will spike when running reports, or collecting data for larger clusters.
- A properly configured kubectl to access the Kubernetes cluster.
Before continuing with the installation, please read Configuring Operator Metering. Some options may not be changed post-install. Be certain to configure these options, if desired, before installation.
If you do not wish to modify the Operator Metering configuration, a minimal configuration example that doesn't override anything can be found in default.yaml.
For installs into Openshift, ensuring Prometheus is installed can be done using Ansible. For installs into Tectonic, the manual installation method configures Metering to use the Prometheus that's installed by default into the tectonic-system namespace.
If you're not using Openshift or Tectonic, then you will need to use OLM or the manual install method. In this case if you are not using a kube-prometheus installation, or your Prometheus service is not named prometheus-k8s
and in the monitoring
namespace, then you must customize the prometheus URL config option before proceeding.
There are multiple installation methods depending on your Kubernetes platform and the version of Operator Metering you want.
Using Ansible is the currently recommended approach for installing onto Openshift. The openshift-metering playbook is included in the openshift-ansible repository and can be used to install and configure operator metering on top of Openshift. It properly handles installing the Metering with the correct configuration for communicating to Openshift Cluster Monitoring, as well as enables other options for better integration with Openshift.
Read the Ansible installation guide for full details on how to use the playbook and what the available parameters are.
Using OLM for installation is the recommended approach for installing the most recent packaged release for Kubernetes. In the future, using OLM on Openshift will be a supported option.
For instructions on installing using OLM follow the OLM installation guide.
Manual installation is generally not recommended as it is always changing and relies on a local checkout of the operator-metering git repository. The primary use for manual installation is for doing development work or installing an unreleased versions of components.
For instructions on installing using our manual install scripts follow the manual installation guide.
First, wait until the Metering Helm operator deploys all of the Metering components:
kubectl get pods -n $METERING_NAMESPACE -l app=metering-operator -o name | cut -d/ -f2 | xargs -I{} kubectl -n $METERING_NAMESPACE logs -f {} -c metering-operator
When output similar to the following appears, the rest of the Pods should be initializing:
Waiting for Tiller to become ready
Waiting for Tiller to become ready
Getting pod metering-operator-b5f86788c-ks4zq owner information
Querying for Deployment metering-operator
No values, using default values
Running helm upgrade for release operator-metering
Release "operator-metering" has been upgraded. Happy Helming!
LAST DEPLOYED: Fri Jan 26 19:18:34 2018
NAMESPACE: metering
STATUS: DEPLOYED
RESOURCES:
... the rest is omitted for brevity ...
Next, get the list of pods:
kubectl -n $METERING_NAMESPACE get pods
It may take a 2-3 minutes, but eventually all pods should have a status of Running
:
NAME READY STATUS RESTARTS AGE
hdfs-datanode-0 1/1 Running 0 9m
hdfs-namenode-0 1/1 Running 0 9m
hive-metastore-0 1/1 Running 0 9m
hive-server-0 1/1 Running 0 9m
metering-operator-df67bb6cb-6d7vh 2/2 Running 1 11m
presto-coordinator-7b7b87ff49-bhzgg 1/1 Running 0 9m
reporting-operator-7cf77b68f9-l6jrd 1/1 Running 1 9m
Check the logs of the reporting-operator
pod for errors:
$ kubectl get pods -n $METERING_NAMESPACE -l app=reporting-operator -o name | cut -d/ -f2 | xargs -I{} kubectl -n $METERING_NAMESPACE logs {} -f
For instructions on using Operator Metering, please see using Operator Metering.