prometheus-statefulset.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. name: prometheus
  5. namespace: kube-system
  6. labels:
  7. k8s-app: prometheus
  8. kubernetes.io/cluster-service: "true"
  9. addonmanager.kubernetes.io/mode: Reconcile
  10. version: v2.2.1
  11. spec:
  12. serviceName: "prometheus"
  13. replicas: 1
  14. podManagementPolicy: "Parallel"
  15. updateStrategy:
  16. type: "RollingUpdate"
  17. selector:
  18. matchLabels:
  19. k8s-app: prometheus
  20. template:
  21. metadata:
  22. labels:
  23. k8s-app: prometheus
  24. annotations:
  25. scheduler.alpha.kubernetes.io/critical-pod: ''
  26. spec:
  27. priorityClassName: system-cluster-critical
  28. serviceAccountName: prometheus
  29. initContainers:
  30. - name: "init-chown-data"
  31. image: "busybox:latest"
  32. imagePullPolicy: "IfNotPresent"
  33. command: ["chown", "-R", "65534:65534", "/data"]
  34. volumeMounts:
  35. - name: prometheus-data
  36. mountPath: /data
  37. subPath: ""
  38. containers:
  39. - name: prometheus-server-configmap-reload
  40. image: "jimmidyson/configmap-reload:v0.1"
  41. imagePullPolicy: "IfNotPresent"
  42. args:
  43. - --volume-dir=/etc/config
  44. - --webhook-url=http://localhost:9090/-/reload
  45. volumeMounts:
  46. - name: config-volume
  47. mountPath: /etc/config
  48. readOnly: true
  49. resources:
  50. limits:
  51. cpu: 10m
  52. memory: 10Mi
  53. requests:
  54. cpu: 10m
  55. memory: 10Mi
  56. - name: prometheus-server
  57. image: "prom/prometheus:v2.2.1"
  58. imagePullPolicy: "IfNotPresent"
  59. args:
  60. - --config.file=/etc/config/prometheus.yml
  61. - --storage.tsdb.path=/data
  62. - --web.console.libraries=/etc/prometheus/console_libraries
  63. - --web.console.templates=/etc/prometheus/consoles
  64. - --web.enable-lifecycle
  65. ports:
  66. - containerPort: 9090
  67. readinessProbe:
  68. httpGet:
  69. path: /-/ready
  70. port: 9090
  71. initialDelaySeconds: 30
  72. timeoutSeconds: 30
  73. livenessProbe:
  74. httpGet:
  75. path: /-/healthy
  76. port: 9090
  77. initialDelaySeconds: 30
  78. timeoutSeconds: 30
  79. # based on 10 running nodes with 30 pods each
  80. resources:
  81. limits:
  82. cpu: 200m
  83. memory: 1000Mi
  84. requests:
  85. cpu: 200m
  86. memory: 1000Mi
  87. volumeMounts:
  88. - name: config-volume
  89. mountPath: /etc/config
  90. - name: prometheus-data
  91. mountPath: /data
  92. subPath: ""
  93. terminationGracePeriodSeconds: 300
  94. volumes:
  95. - name: config-volume
  96. configMap:
  97. name: prometheus-config
  98. volumeClaimTemplates:
  99. - metadata:
  100. name: prometheus-data
  101. spec:
  102. storageClassName: standard
  103. accessModes:
  104. - ReadWriteOnce
  105. resources:
  106. requests:
  107. storage: "16Gi"