Devops's Blog

Prometeus в k8s


---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mon-pvc-1
  namespace: monitoring
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 1Gi
---
kind: Service
apiVersion: v1
metadata:
  name: prometheus-svc
  namespace: monitoring
spec:
  type: NodePort
  selector:
    app: prometheus-server
  ports:
    - protocol: TCP
      nodePort: 30010
      port: 9090

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-server
  namespace: monitoring
  labels:
    app: prometheus-server
spec:
  selector:
    matchLabels:
        app: prometheus-server
  replicas: 1
  template:
    metadata:
      labels:
        app: prometheus-server
    spec:
      containers:
      - name: prometheus-server
        image: "bitnami/prometheus:2.38.0"
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            cpu: 1024m
            memory: 512Mi
          requests:
            cpu: 256m
            memory: 256Mi
        ports:
        - containerPort: 9090
        volumeMounts:
        - name: config-prometheus
          mountPath: /opt/bitnami
      volumes:
      - name: config-prometheus
        persistentVolumeClaim:
          claimName: mon-pvc-1