Merge pull request #549 from 3dwardch3ng/infra/prometheus
add infra app prometheus
This commit is contained in:
12
infrastructures/prometheus/env/k3s-cluster/cluster-role-binding.yaml
vendored
Normal file
12
infrastructures/prometheus/env/k3s-cluster/cluster-role-binding.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: prometheus
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: prometheus
|
||||||
|
namespace: prometheus
|
||||||
20
infrastructures/prometheus/env/k3s-cluster/cluster-role.yaml
vendored
Normal file
20
infrastructures/prometheus/env/k3s-cluster/cluster-role.yaml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources:
|
||||||
|
- nodes
|
||||||
|
- nodes/proxy
|
||||||
|
- services
|
||||||
|
- endpoints
|
||||||
|
- pods
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- apiGroups:
|
||||||
|
- extensions
|
||||||
|
resources:
|
||||||
|
- ingresses
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- nonResourceURLs: ["/metrics"]
|
||||||
|
verbs: ["get"]
|
||||||
12
infrastructures/prometheus/env/k3s-cluster/config.json
vendored
Normal file
12
infrastructures/prometheus/env/k3s-cluster/config.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"appName": "prometheus",
|
||||||
|
"userGivenName": "prometheus",
|
||||||
|
"namespace": "prometheus",
|
||||||
|
"destNamespace": "prometheus",
|
||||||
|
"destServer": "https://kubernetes.default.svc",
|
||||||
|
"srcPath": "infrastructures/prometheus/env/k3s-cluster",
|
||||||
|
"srcRepoURL": "https://github.com/3dwardch3ng/home-cluster-ops.git",
|
||||||
|
"srcTargetRevision": "",
|
||||||
|
"labels": null,
|
||||||
|
"annotations": null
|
||||||
|
}
|
||||||
87
infrastructures/prometheus/env/k3s-cluster/deployment.yaml
vendored
Normal file
87
infrastructures/prometheus/env/k3s-cluster/deployment.yaml
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
namespace: prometheus
|
||||||
|
labels:
|
||||||
|
app: prometheus
|
||||||
|
spec:
|
||||||
|
strategy:
|
||||||
|
rollingUpdate: null
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: prometheus
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: prometheus
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
runAsGroup: 0
|
||||||
|
containers:
|
||||||
|
- name: prometheus
|
||||||
|
image: prom/prometheus:v2.53.0
|
||||||
|
args:
|
||||||
|
- "--storage.tsdb.retention.time=14d"
|
||||||
|
- "--config.file=/etc/prometheus/prometheus.yaml"
|
||||||
|
- "--storage.tsdb.path=/prometheus/"
|
||||||
|
ports:
|
||||||
|
- containerPort: 9090
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 500M
|
||||||
|
limits:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 2Gi
|
||||||
|
volumeMounts:
|
||||||
|
- name: prometheus-config-volume
|
||||||
|
mountPath: /etc/prometheus/
|
||||||
|
- name: prometheus-storage-volume
|
||||||
|
mountPath: /prometheus/
|
||||||
|
- name: grafana
|
||||||
|
image: grafana/grafana:11.0.1
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
volumeMounts:
|
||||||
|
- name: grafana-config-volume
|
||||||
|
mountPath: /etc/grafana
|
||||||
|
- name: grafana-data-volume
|
||||||
|
mountPath: /var/lib/grafana
|
||||||
|
- name: grafana-logs-volume
|
||||||
|
mountPath: /var/log/grafana
|
||||||
|
- name: grafana-plugins-volume
|
||||||
|
mountPath: /var/lib/grafana/plugins
|
||||||
|
- name: grafana-provisioning-volume
|
||||||
|
mountPath: /etc/grafana/provisioning
|
||||||
|
volumes:
|
||||||
|
- name: prometheus-config-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/prometheus/conf
|
||||||
|
type: Directory
|
||||||
|
- name: prometheus-storage-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/prometheus/storage
|
||||||
|
type: Directory
|
||||||
|
- name: grafana-config-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/grafana/config
|
||||||
|
type: Directory
|
||||||
|
- name: grafana-data-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/grafana/data
|
||||||
|
type: Directory
|
||||||
|
- name: grafana-logs-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/grafana/logs
|
||||||
|
type: Directory
|
||||||
|
- name: grafana-plugins-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/grafana/plugins
|
||||||
|
type: Directory
|
||||||
|
- name: grafana-provisioning-volume
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/nfs/AppData/grafana/provisioning
|
||||||
|
type: Directory
|
||||||
7
infrastructures/prometheus/env/k3s-cluster/kustomization.yaml
vendored
Normal file
7
infrastructures/prometheus/env/k3s-cluster/kustomization.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ./cluster-role.yaml
|
||||||
|
- ./cluster-role-binding.yaml
|
||||||
|
- ./deployment.yaml
|
||||||
|
- ./service.yaml
|
||||||
22
infrastructures/prometheus/env/k3s-cluster/service.yaml
vendored
Normal file
22
infrastructures/prometheus/env/k3s-cluster/service.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
namespace: prometheus
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: 'true'
|
||||||
|
prometheus.io/port: '9999'
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: prometheus
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 9999
|
||||||
|
targetPort: 9090
|
||||||
|
nodePort: 30999
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
- name: grafana-port
|
||||||
|
port: 3030
|
||||||
|
nodePort: 30303
|
||||||
|
targetPort: 3000
|
||||||
Reference in New Issue
Block a user