| ################################################################################ |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| ################################################################################ |
| |
| apiVersion: extensions/v1beta1 |
| kind: Deployment |
| metadata: |
| name: prometheus |
| labels: |
| app: prometheus |
| spec: |
| replicas: 1 |
| template: |
| metadata: |
| labels: |
| app: prometheus |
| spec: |
| containers: |
| - image: prom/pushgateway |
| name: pushgateway |
| ports: |
| - containerPort: 9091 |
| - image: prom/prometheus |
| name: prometheus |
| securityContext: |
| runAsUser: 0 |
| ports: |
| - containerPort: 9090 |
| args: |
| - --config.file=/etc/prometheus/prometheus.yml |
| - --web.console.libraries=/etc/prometheus/console_libraries |
| - --web.console.templates=/etc/prometheus/consoles |
| - --storage.tsdb.path=/prometheus |
| - --storage.tsdb.retention.time=365d |
| volumeMounts: |
| - mountPath: /prometheus |
| name: prometheus-storage |
| - mountPath: /etc/prometheus |
| name: prometheus-config |
| readOnly: true |
| - image: prom/alertmanager |
| name: alertmanager |
| ports: |
| - containerPort: 9093 |
| volumeMounts: |
| - mountPath: /etc/alertmanager |
| name: alertmanager-config |
| readOnly: true |
| restartPolicy: Always |
| volumes: |
| - name: prometheus-storage |
| persistentVolumeClaim: |
| claimName: prometheus-storage |
| - name: prometheus-config |
| configMap: |
| name: prometheus-config |
| - name: alertmanager-config |
| configMap: |
| name: alertmanager-config |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: prometheus |
| labels: |
| app: prometheus |
| spec: |
| ports: |
| - port: 9090 |
| targetPort: 9090 |
| selector: |
| app: prometheus |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: pushgateway |
| labels: |
| app: prometheus |
| spec: |
| type: NodePort |
| ports: |
| - port: 9091 |
| targetPort: 9091 |
| nodePort: 30000 |
| selector: |
| app: prometheus |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: alertmanager |
| labels: |
| app: prometheus |
| spec: |
| ports: |
| - port: 9093 |
| targetPort: 9093 |
| selector: |
| app: prometheus |
| --- |
| apiVersion: v1 |
| kind: PersistentVolumeClaim |
| metadata: |
| name: prometheus-storage |
| spec: |
| accessModes: |
| - ReadWriteOnce |
| resources: |
| requests: |
| storage: 10Gi |