During the 4.2 development cycle, support for installing metering on a vanilla kubernetes cluster was implemented. Previously, you had to manually tweak and configure pod security permissions and disable TLS/OCP-only features yourself.
In order to do this, the metering-ansible-operator was updated to work with another set of override variables that's contingent on the value of the MeteringConfig
field spec.disableOCPFeatures
, being set to true
. Alternatively, if running metering locally (via make run-metering-operator-local
), you can set the $DISABLE_OCP_FEATURES
environment variable to true
.
This also added another set of manifest files (manifest/deploy/upstream
) which are used to install the upstream package which is available via the community-operators package in OperatorHub.io.
Before proceeding to the installation section, see the prerequisites section for instructions on setting up a kubernetes environment.
You will first need access to a Kubernetes cluster, and Minikube is the simplest method, but metering is very resource heavy, so a GKE cluster is recommended.
If using minikube, you will need to increase the default resources:
$ minikube delete && minikube start --cpus 8 --memory 8192
Note: when using minikube and HDFS as your storage option, you need to update the HDFS pod security permissions (or update permissions on hostPath volume):
spec:
hadoop:
spec:
hdfs:
securityContext:
runAsUser: 0
runAsNonRoot: false
Once you have gained access to a Kubernetes cluster, you must set the reporting-operator prometheus URL to a non-empty, valid URL. See configuring-reporting-operator.md for more detailed information.
In short, you have two options: configure the prometheus URL manually, or use the recommended option, kube-prometheus.
See kube-prometheus quickstart for more information on the commands used below:
$ git clone https://github.com/coreos/kube-prometheus
$ cd $GOPATH/src/github.com/coreos/kube-prometheus
$ kubectl create -f manifests/
$ until kubectl get customresourcedefinitions servicemonitors.monitoring.coreos.com ; do date; sleep 1; echo ""; done
$ until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done
$ kubectl apply -f manifests/
You may need to run the last command twice in the case where resources weren't ready and creating the manifests contained errors when running.
After installing the manifests, you should see a monitoring
namespace in your cluster, and have access to the "http://prometheus-k8s.monitoring.svc:9090"
prometheus URL.
Note: set the $METERING_CR_FILE
environment variable before preceding.
./hack/upstream-install.sh
./hack/upstream-olm-install.sh
It's recommended to install via Operatorhub.io.
apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
name: "operator-metering"
spec:
disableOCPFeatures: true
reporting-operator:
spec:
config:
prometheus:
url: "http://prometheus-k8s.monitoring.svc:9090"
unsupportedFeatures:
enableHDFS: true
storage:
type: "hive"
hive:
type: "hdfs"
hdfs:
namenode: "hdfs-namenode-0.hdfs-namenode:9820"
Note: in order to use the upstream override values, you must have the following conditions:
- Configure storage for metering.
- Set
spec.disableOCPFeatures: true
. - Set
spec.reporting-operator.spec.config.prometheus.url
to a prometheus URL.