Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Latest commit

 

History

History
82 lines (64 loc) · 2 KB

deploy_prometheus_workload.md

File metadata and controls

82 lines (64 loc) · 2 KB

Prometheus Extended Workload

Deploy Prometheus Operator

$ kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/master/bundle.yaml

Define the Prometheus component

The component must have a workloadType combined with GROUP/VERSION.KIND, so the Non-Intrusive Workload will find which custom resource to create.

Then put the whole spec in the workloadSettings value with a name called spec like below.

apiVersion: core.oam.dev/v1alpha1
kind: ComponentSchematic
metadata:
  name: prometheus
spec:
  workloadType: monitoring.coreos.com/v1.Prometheus
  osType: linux
  workloadSettings:
    - name: spec
      type: object
      description: the spec of prometheus-operator
      required: true
      value:
        serviceAccountName: default
        serviceMonitorSelector:
          matchLabels:
            team: frontend
        resources:
          requests:
            memory: 400Mi
        enableAdminAPI: true

Prepare the application configuration

The application configuration just need to use this component.

apiVersion: core.oam.dev/v1alpha1
kind: ApplicationConfiguration
metadata:
  name: prometheus
spec:
  components:
    - componentName: prometheus
      instanceName: prometheus-app

Apply our configurations

$ kubectl apply -f examples/prometheusapp.yaml
componentschematic.core.oam.dev/prometheus created
applicationconfiguration.core.oam.dev/prometheus created

we could see that an Prometheus Operator CR was created by rudr.

$ kubectl get prometheuses
NAME             AGE
prometheus-app   37s

Then the Prometheus operator we create an real Prometheus app described by the CR.

$ kubectl get statefulset
NAME                        READY   AGE
prometheus-prometheus-app   1/1     6m21s

You could change the component spec as you like if you want.

TODO

  • Register and generate serving information for this Prometheus workload for other workload to consume.