Setup Metering Operator in OpenShift using static NFS volume

Install the Metering Operator

apiVersion: v1
kind: Namespace
metadata:
name: openshift-metering
annotations:
openshift.io/node-selector: ""
labels:
openshift.io/cluster-monitoring: "true"
$ oc create -f namespace-openshift-metering.yaml
namespace/openshift-metering created
  1. In the OpenShift Container Platform web console, click OperatorsOperatorHub. Filter for metering to find the Metering Operator.
  2. Click the Metering card, review the package description, and then click Install.
  3. Select an Update Channel, Installation Mode, and Approval Strategy.
  4. Click Subscribe.
  5. Verify that the Metering Operator is installed by switching to the OperatorsInstalled Operators page. The Metering Operator has a Status of Succeeded when the installation is complete.

Prepare Persistent Volumes

Step 1: Prepare the NFS exports

  • Metering warehouse data: /mnt/nfsdata/metering/warehouse
  • Hive metastore DB data: /mnt/nfsdata/metering/dbdata

Step 2: Create PV and PVC for metering warehouse data

apiVersion: v1
kind: PersistentVolume
metadata:
name: metering-warehouse-pv
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 100Gi
nfs:
path: /mnt/nfsdata/metering/warehouse
server: nfsserver
persistentVolumeClaimPolicy: Retain
storageClassName: static-nfs
$ oc create -f metering-warehouse-pv.yaml
persistentvolume/metering-warehouse-pv created
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: metering-warehouse-pvc
namespace: openshift-metering
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: static-nfs
volumeName: metering-warehouse-pv
$ oc create -f metering-warehouse-pvc.yaml
persistentvolumeclaim/metering-warehouse-pvc created

Step 3: Create PV and PVC for hive metastore DB data

apiVersion: v1
kind: PersistentVolume
metadata:
name: hive-metastore-db-data-pv
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
nfs:
path: /mnt/nfsdata/metering/dbdata
server: nfsserver
persistentVolumeClaimPolicy: Retain
storageClassName: static-nfs
$ oc create -f hive-metastore-db-data-pv.yaml
persistentvolume/hive-metastore-db-data-pv created
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: hive-metastore
metering.openshift.io/ns-prune: openshift-metering
metering.openshift.io/prune: hive-metastore-pvc
name: hive-metastore-db-data
namespace: openshift-metering
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: static-nfs
volumeName: hive-metastore-db-data-pv
$ oc create -f hive-metastore-db-data-pvc.yaml
persistentvolumeclaim/hive-metastore-db-data created

Step 4: Verify the PVCs

$ oc get pvc -n openshift-metering
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
hive-metastore-db-data Bound hive-metastore-db-data-pv 5Gi RWO static-nfs 17s
metering-warehouse-pvc Bound metering-warehouse-pv 100Gi RWX static-nfs 4m46s

Deploy the Metering stack

apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
name: operator-metering
namespace: openshift-metering
spec:
storage:
type: hive
hive:
type: sharedPVC
sharedPVC:
claimName: metering-warehouse-pvc
$ oc create -f metering-config.yaml
meteringconfig.metering.openshift.io/operator-metering created
$ oc get meteringconfig -n openshift-metering
NAME AGE
operator-metering 12s
$ oc get pods -n openshift-metering
NAME READY STATUS RESTARTS AGE
hive-metastore-0 2/2 Running 0 11m
hive-server-0 3/3 Running 0 11m
metering-operator-7cbf68cd4c-4m4rx 2/2 Running 0 29m
presto-coordinator-0 2/2 Running 0 10m
reporting-operator-d8f55dc45-rvhbg 1/2 Running 0 10m

--

--

--

Infrastructure Architect experienced in design and implementation of IT solutions for enterprises

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Nym Incentivized Testnet and Reputation System

Testing AWS Lambda with AVA

Introduction of my First Android Application

Progressive Web Apps 101: the What, Why and How

Open Source phase — Part III

The most frustrating thing about Git…

When Should You Use Microservices?

Cross-Platform App Development is the buzzword among businesses and developers the world over today.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Edmond Chan

Edmond Chan

Infrastructure Architect experienced in design and implementation of IT solutions for enterprises

More from Medium

Set up Kubernetes Cluster using Kind in 2 mins

Deploying WSO2 Identity Server 5.12.0 on Kubernetes (Local and AWS EKS)

Configure nginx ingress controller to scrape Prometheus metrics with Azure Container Insights in…

Installation of Kubernetes cluster with docker containers