Create Service accounts for the project you deploying the prometheus pod.

oc create serviceaccount  -n
oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount::

oc create serviceaccount metrics -n paas-prometheus
oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:paas-prometheus:metrics

Creating the Docker image

    #Base Image
    FROM docker.io/prom/prometheus
    #copy the config yaml file to the directory
    ADD prometheus.yml /etc/prometheus/
    #expose the port
    EXPOSE 9090

Prometheus.yml File

    global:
     scrape_interval: 10s
     evaluation_interval: 10s

    rule_files:
     - "*.rules"


    scrape_configs:
    - job_name: 'kubernetes-cluster'
     tls_config:
     ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
     bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token

    scheme: https

    kubernetes_sd_configs:
     - api_servers:
     - ''
     in_cluster: true
     role: apiserver
     relabel_configs:
     - source_labels: [__meta_kubernetes_role]
     action: keep
     regex: (?:apiserver|node)
     - action: labelmap
     regex: __meta_kubernetes_node_label_(.+)
     - source_labels: [__meta_kubernetes_role]
     action: replace
     target_label: kubernetes_role

    - job_name: 'kubernetes-apiservers'
     scheme: https
     tls_config:
     ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
     bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
     kubernetes_sd_configs:
     - api_servers:
     - ''
     in_cluster: true
     role: apiserver
     relabel_configs:
     - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
     action: keep
     regex: default;kubernetes;https

    - job_name: 'kubernetes-nodes'
     scheme: https
     tls_config:
     ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
     bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
     kubernetes_sd_configs:
     - api_servers:
     - ''
     in_cluster: true
     role: node
     relabel_configs:
     - action: labelmap
     regex: __meta_kubernetes_node_label_(.+)

Create prometheus app

    Create prometheus app
    #build docker images
    docker build -t  .

    #tag image accordingly
    docker tag  //

    #login to ose docker registry
    docker login -u  -p  -e  

    #push to the ose docker registry
    docker push //

    #switch to the project (pre-req: you need to login to ose via oc client)
    oc project

craete new app

    #craete new app
    oc new-app -f prometheus-template.json
prometheus-template.json
{
  "kind": "Template",
  "apiVersion": "v1",
  "metadata": {
    "name": "prometheus",
    "annotations": {
      "description": "Prometheus App Template",
      "iconClass": "icon-php",
      "tags": "php,laravel"
    }
  },
  "labels": {
    "application": "prometheus-template",
    "createdBy": "paas-ops"
  },
  "objects": [
    {
      "kind": "Route",
      "apiVersion": "v1",
      "metadata": {
        "name": "prometheus"
      },
      "spec": {
        "host": "",
        "to": {
          "kind": "Service",
          "name": "prometheus"
        },
        "tls": {
          "termination": "edge",
          "insecureEdgeTerminationPolicy": "Allow"
        }
      }
    },
    {
      "kind": "Service",
      "apiVersion": "v1",
      "metadata": {
        "name": "prometheus"
      },
      "spec": {
        "ports": [
          {
            "name": "prometheus",
            "port": 80,
            "targetPort": 9090
          }
        ],
        "selector": {
          "name": "prometheus"
        },
        "type": "ClusterIP",
        "sessionAffinity": "None"
      }
    },
    {
      "kind": "DeploymentConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "prometheus"
      },
      "spec": {
        "template": {
          "metadata": {
            "labels": {
              "name": "prometheus"
            }
          },
          "spec": {
            "containers": [
              {
                "name": "prometheus",
                "image": "/",
                "ports": [
                  {
                    "containerPort": 9090,
                    "name": "http"
                  }
                ],
                "livenessProbe": {
                  "tcpSocket": {
                    "port": 9090
                  }
                },
                "resources": {
                  "limits": {
                    "cpu": "2",
                    "memory": "6G"
                  },
                  "requests": {
                    "cpu": "200m",
                    "memory": "100Mi"
                  }
                },
                "terminationMessagePath": "/dev/termination-log",
                "volumeMounts": [
                  {
                    "mountPath": "/prometheus",
                    "name": "prometheus-data",
                    "readOnly": false
                  }
                ],
                "securityContext": {
                  "capabilities": {},
                  "privileged": false
                }
              }
            ],
            "imagePullPolicy": "IfNotPresent",
            "serviceAccountName": "metrics",
            "volumes": [
              {
                "name": "prometheus-data",
                "persistentVolumeClaim": {
                  "claimName": "pvc-uat-prometheus"
                }
              }
            ],
            "nodeSelector": {
              "region": "perfmon"
            }
          }
        },
        "replicas": 1,
        "selector": {
          "name": "prometheus"
        },
        "triggers": [
          {
            "type": "ConfigChange"
          },
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": ["prometheus"],
              "from": {
                "kind": "ImageStreamTag",
                "name": "prometheus:latest"
              }
            }
          }
        ],
        "strategy": {
          "type": "Rolling"
        }
      }
    }
  ]
}