This commit is contained in:
2025-12-10 12:26:43 +01:00
parent 539b30e974
commit d813155eb9
9 changed files with 297 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: root-app
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://gitea.mathod.fr/mathod/argocd-gitops.git
targetRevision: HEAD
path: apps
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: true

View File

@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: argocd-metrics-server
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://gitea.mathod.fr/mathod/argocd-gitops.git
targetRevision: HEAD
path: manifests/metrics-server
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: true

View File

@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: podinfo
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://github.com/stefanprodan/podinfo.git
targetRevision: HEAD
path: kustomize
destination:
server: https://kubernetes.default.svc
namespace: podinfo
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true

View File

@@ -0,0 +1,62 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kube-prometheus-stack
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
# Using Helm chart directly from the official repository
repoURL: https://prometheus-community.github.io/helm-charts
chart: kube-prometheus-stack
targetRevision: 65.1.1
helm:
values: |
# Disable alertmanager for simplicity
alertmanager:
enabled: false
# Configure Prometheus
prometheus:
prometheusSpec:
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: 500m
memory: 1Gi
retention: 6h
storageSpec:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
# Configure Grafana
grafana:
enabled: true
adminPassword: admin
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
destination:
server: https://kubernetes.default.svc
namespace: monitoring
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- ServerSideApply=true

View File

@@ -0,0 +1,34 @@
# Argo CD Server configuration
server:
# Enable and configure extensions
extensions:
enabled: true
extensionList:
- name: extension-metrics
env:
- name: EXTENSION_URL
value: https://github.com/argoproj-labs/argocd-extension-metrics/releases/download/v1.0.3/extension.tar.gz
- name: EXTENSION_CHECKSUM_URL
value: https://github.com/argoproj-labs/argocd-extension-metrics/releases/download/v1.0.3/extension_checksums.txt
# Argo CD configuration
configs:
# ConfigMap for extension configuration
cm:
extension.config: |
extensions:
- name: metrics
backend:
services:
- url: http://argocd-metrics-server.argocd.svc:9003
# Server parameters
params:
# Enable the proxy extension feature (required for metrics)
server.enable.proxy.extension: "true"
# RBAC configuration
rbac:
policy.csv: |
p, role:readonly, extensions, invoke, metrics, allow
p, role:admin, extensions, invoke, metrics, allow

View File

@@ -0,0 +1,53 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-metrics-server-configmap
data:
# Metrics for Deployments
extension.metrics.deployments: |
- name: "CPU Usage"
description: "CPU usage for the deployment"
type: "graph"
graphType: "area"
yAxisLabel: "CPU Cores"
query: 'sum(rate(container_cpu_usage_seconds_total{namespace="{{.metadata.namespace}}", pod=~"{{.metadata.name}}-.*"}[5m])) by (pod)'
- name: "Memory Usage"
description: "Memory usage for the deployment"
type: "graph"
graphType: "area"
yAxisLabel: "Memory (MB)"
query: 'sum(container_memory_working_set_bytes{namespace="{{.metadata.namespace}}", pod=~"{{.metadata.name}}-.*"}) by (pod) / 1024 / 1024'
- name: "Network Received"
description: "Network bytes received"
type: "graph"
graphType: "line"
yAxisLabel: "Bytes/sec"
query: 'sum(rate(container_network_receive_bytes_total{namespace="{{.metadata.namespace}}", pod=~"{{.metadata.name}}-.*"}[5m])) by (pod)'
# Metrics for Pods
extension.metrics.pods: |
- name: "CPU Usage"
description: "CPU usage for the pod"
type: "graph"
graphType: "area"
yAxisLabel: "CPU Cores"
query: 'sum(rate(container_cpu_usage_seconds_total{namespace="{{.metadata.namespace}}", pod="{{.metadata.name}}"}[5m])) by (container)'
- name: "Memory Usage"
description: "Memory usage for the pod"
type: "graph"
graphType: "area"
yAxisLabel: "Memory (MB)"
query: 'sum(container_memory_working_set_bytes{namespace="{{.metadata.namespace}}", pod="{{.metadata.name}}"}) by (container) / 1024 / 1024'
- name: "Container Restarts"
description: "Number of container restarts"
type: "graph"
graphType: "line"
yAxisLabel: "Restarts"
query: 'kube_pod_container_status_restarts_total{namespace="{{.metadata.namespace}}", pod="{{.metadata.name}}"}'
# Prometheus connection
prometheus.url: "http://prometheus-kube-prometheus-prometheus.monitoring.svc:9090"

View File

@@ -0,0 +1,73 @@
apiVersion: v1
kind: Service
metadata:
name: argocd-metrics-server
labels:
app: argocd-metrics-server
spec:
ports:
- name: http
port: 9003
protocol: TCP
targetPort: 9003
selector:
app: argocd-metrics-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: argocd-metrics-server
labels:
app: argocd-metrics-server
spec:
replicas: 1
selector:
matchLabels:
app: argocd-metrics-server
template:
metadata:
labels:
app: argocd-metrics-server
spec:
containers:
- name: argocd-metrics-server
image: quay.io/argoprojlabs/argocd-extension-metrics:v1.0.3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9003
name: http
protocol: TCP
env:
- name: PROMETHEUS_URL
valueFrom:
configMapKeyRef:
name: argocd-metrics-server-configmap
key: prometheus.url
volumeMounts:
- name: config
mountPath: /etc/argocd-metrics-server/
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
volumes:
- name: config
configMap:
name: argocd-metrics-server-configmap
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault

View File

@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: argocd
resources:
- configmap.yaml
- deployment.yaml
commonLabels:
app: argocd-metrics-server
app.kubernetes.io/name: argocd-metrics-server
app.kubernetes.io/component: metrics-server