From d94e72cab9750ed724d3b64422cddcc9df3172b1 Mon Sep 17 00:00:00 2001 From: Vaishali Varshney Date: Wed, 11 Feb 2026 08:48:48 -0800 Subject: [PATCH 1/3] fix otel; added loki --- iac/apps/labapiserver/values.yaml | 10 ++++ iac/apps/loki/values.yaml | 70 +++++++++++++++++++++++++++ iac/apps/otel-collector/values.yaml | 42 +++++++++++++--- iac/apps/promtail/values.yaml | 36 ++++++++++++++ iac/argocd/applications/loki.yaml | 32 ++++++++++++ iac/argocd/applications/promtail.yaml | 32 ++++++++++++ 6 files changed, 214 insertions(+), 8 deletions(-) create mode 100644 iac/apps/loki/values.yaml create mode 100644 iac/apps/promtail/values.yaml create mode 100644 iac/argocd/applications/loki.yaml create mode 100644 iac/argocd/applications/promtail.yaml diff --git a/iac/apps/labapiserver/values.yaml b/iac/apps/labapiserver/values.yaml index 88852c6..aae8128 100644 --- a/iac/apps/labapiserver/values.yaml +++ b/iac/apps/labapiserver/values.yaml @@ -90,8 +90,18 @@ env: value: "info" - name: OTEL_EXPORTER_OTLP_ENDPOINT value: "otel-collector-opentelemetry-collector.otel-collector.svc.cluster.local:4317" + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: "grpc" - name: OTEL_SERVICE_NAME value: "labapiserver" + - name: OTEL_EXPORTER_OTLP_INSECURE + value: "true" + - name: OTEL_TRACES_EXPORTER + value: "otlp" + - name: OTEL_METRICS_EXPORTER + value: "otlp" + - name: OTEL_LOGS_EXPORTER + value: "otlp" # Vault secrets - these will be injected by Vault agent vaultSecrets: diff --git a/iac/apps/loki/values.yaml b/iac/apps/loki/values.yaml new file mode 100644 index 0000000..5f3a6cb --- /dev/null +++ b/iac/apps/loki/values.yaml @@ -0,0 +1,70 @@ +loki: + auth_enabled: false + + commonConfig: + replication_factor: 1 + + storage: + type: filesystem + + schemaConfig: + configs: + - from: 2024-01-01 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + + ingester: + chunk_encoding: snappy + + limits_config: + retention_period: 168h # 7 days + ingestion_rate_mb: 10 + ingestion_burst_size_mb: 20 + +# Single binary mode for lab environment +deploymentMode: SingleBinary + +singleBinary: + replicas: 1 + resources: + limits: + cpu: 1 + memory: 1Gi + requests: + cpu: 100m + memory: 256Mi + persistence: + enabled: true + size: 10Gi + +# Disable components not needed in single binary mode +backend: + replicas: 0 +read: + replicas: 0 +write: + replicas: 0 + +# Gateway configuration +gateway: + enabled: true + service: + type: ClusterIP + port: 80 + +# Enable service monitor for Prometheus +monitoring: + serviceMonitor: + enabled: false + selfMonitoring: + enabled: false + grafanaAgent: + installOperator: false + +# Test configuration +test: + enabled: false diff --git a/iac/apps/otel-collector/values.yaml b/iac/apps/otel-collector/values.yaml index 8173e01..1ac04c3 100644 --- a/iac/apps/otel-collector/values.yaml +++ b/iac/apps/otel-collector/values.yaml @@ -34,6 +34,14 @@ opentelemetry-collector: memory_limiter: check_interval: 1s limit_mib: 400 + spike_limit_mib: 128 + check_interval: 5s + + resource: + attributes: + - key: service.namespace + from_attribute: k8s.namespace.name + action: upsert exporters: prometheus: @@ -42,27 +50,45 @@ opentelemetry-collector: logging: loglevel: info - otlp: - endpoint: "prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local:9090" + prometheusremotewrite: + endpoint: "http://prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local:9090/api/v1/write" tls: insecure: true + + loki: + endpoint: http://loki-gateway.observability.svc.cluster.local/loki/api/v1/push + default_labels_enabled: + exporter: true + job: true + instance: true + level: true + + otlp/traces: + endpoint: http://tempo.observability.svc.cluster.local:4317 + tls: + insecure: true + + debug: + verbosity: detailed + sampling_initial: 5 + sampling_thereafter: 200 service: pipelines: traces: receivers: [otlp] - processors: [memory_limiter, batch] - exporters: [logging] + processors: [memory_limiter, batch, resource] + exporters: [otlp/traces] metrics: receivers: [otlp, prometheus] - processors: [memory_limiter, batch] - exporters: [prometheus, logging] + processors: [memory_limiter, batch, resource] + exporters: [prometheus, prometheusremotewrite, logging] logs: receivers: [otlp] - processors: [memory_limiter, batch] - exporters: [logging] + processors: [memory_limiter, batch, resource] + exporters: [loki] ports: otlp: diff --git a/iac/apps/promtail/values.yaml b/iac/apps/promtail/values.yaml new file mode 100644 index 0000000..245ee49 --- /dev/null +++ b/iac/apps/promtail/values.yaml @@ -0,0 +1,36 @@ +config: + clients: + - url: http://loki-gateway.observability.svc.cluster.local/loki/api/v1/push + tenant_id: 1 + + snippets: + pipelineStages: + - cri: {} + - labeldrop: + - filename + - json: + expressions: + level: level + msg: msg + trace_id: trace_id + span_id: span_id + - labels: + level: + trace_id: + span_id: + +resources: + limits: + cpu: 200m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi + +# DaemonSet configuration to run on all nodes +daemonset: + enabled: true + +# Service Monitor for Prometheus +serviceMonitor: + enabled: false diff --git a/iac/argocd/applications/loki.yaml b/iac/argocd/applications/loki.yaml new file mode 100644 index 0000000..918f6d9 --- /dev/null +++ b/iac/argocd/applications/loki.yaml @@ -0,0 +1,32 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: loki + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://grafana.github.io/helm-charts + chart: loki + targetRevision: 6.16.0 + helm: + valueFiles: + - $values/iac/apps/loki/values.yaml + sources: + - repoURL: https://grafana.github.io/helm-charts + chart: loki + targetRevision: 6.16.0 + - repoURL: https://github.com/mvarshney/labapiserver.git + targetRevision: main + ref: values + destination: + server: https://kubernetes.default.svc + namespace: observability + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/iac/argocd/applications/promtail.yaml b/iac/argocd/applications/promtail.yaml new file mode 100644 index 0000000..70ccc91 --- /dev/null +++ b/iac/argocd/applications/promtail.yaml @@ -0,0 +1,32 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: promtail + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://grafana.github.io/helm-charts + chart: promtail + targetRevision: 6.16.6 + helm: + valueFiles: + - $values/iac/apps/promtail/values.yaml + sources: + - repoURL: https://grafana.github.io/helm-charts + chart: promtail + targetRevision: 6.16.6 + - repoURL: https://github.com/mvarshney/labapiserver.git + targetRevision: main + ref: values + destination: + server: https://kubernetes.default.svc + namespace: observability + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true From ded52f27c910f06aadd9f3901547f13bee747905 Mon Sep 17 00:00:00 2001 From: Vaishali Varshney Date: Wed, 11 Feb 2026 08:52:14 -0800 Subject: [PATCH 2/3] added tempo --- iac/argocd/applications/tempo.yaml | 24 +++++++++++++++++++ iac/argocd/apps/tempo/Chart.yaml | 7 ++++++ iac/argocd/apps/tempo/values.yaml | 37 ++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 iac/argocd/applications/tempo.yaml create mode 100644 iac/argocd/apps/tempo/Chart.yaml create mode 100644 iac/argocd/apps/tempo/values.yaml diff --git a/iac/argocd/applications/tempo.yaml b/iac/argocd/applications/tempo.yaml new file mode 100644 index 0000000..9807d3e --- /dev/null +++ b/iac/argocd/applications/tempo.yaml @@ -0,0 +1,24 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: tempo + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://github.com/mvarshney/labapiserver.git + targetRevision: main + path: iac/argocd/apps/tempo + + destination: + server: https://kubernetes.default.svc + namespace: observability + + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/iac/argocd/apps/tempo/Chart.yaml b/iac/argocd/apps/tempo/Chart.yaml new file mode 100644 index 0000000..d592568 --- /dev/null +++ b/iac/argocd/apps/tempo/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: tempo +version: 1.0.0 +dependencies: + - name: tempo + version: 1.7.2 + repository: https://grafana.github.io/helm-charts diff --git a/iac/argocd/apps/tempo/values.yaml b/iac/argocd/apps/tempo/values.yaml new file mode 100644 index 0000000..e302fee --- /dev/null +++ b/iac/argocd/apps/tempo/values.yaml @@ -0,0 +1,37 @@ +tempo: + receivers: + jaeger: + protocols: + thrift_http: + endpoint: 0.0.0.0:14268 + grpc: + endpoint: 0.0.0.0:14250 + zipkin: + endpoint: 0.0.0.0:9411 + otlp: + protocols: + http: + endpoint: 0.0.0.0:4318 + grpc: + endpoint: 0.0.0.0:4317 + storage: + trace: + backend: local + +persistence: + enabled: true + size: 10Gi + +service: + type: ClusterIP + +serviceMonitor: + enabled: true + +resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 500m + memory: 512Mi From 1b12e8e0f7aa84593b78571f0894eb8116fb8291 Mon Sep 17 00:00:00 2001 From: Vaishali Varshney Date: Wed, 11 Feb 2026 09:06:33 -0800 Subject: [PATCH 3/3] added locust client --- iac/apps/locust/configmap.yaml | 24 ++++++++ iac/apps/locust/deployment.yaml | 78 +++++++++++++++++++++++++ iac/apps/locust/service.yaml | 20 +++++++ iac/argocd/applications/locust-app.yaml | 22 +++++++ 4 files changed, 144 insertions(+) create mode 100644 iac/apps/locust/configmap.yaml create mode 100644 iac/apps/locust/deployment.yaml create mode 100644 iac/apps/locust/service.yaml create mode 100644 iac/argocd/applications/locust-app.yaml diff --git a/iac/apps/locust/configmap.yaml b/iac/apps/locust/configmap.yaml new file mode 100644 index 0000000..8466f92 --- /dev/null +++ b/iac/apps/locust/configmap.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: locust-script + namespace: default +data: + locustfile.py: | + from locust import HttpUser, task, between + import random + + class LabAPIUser(HttpUser): + wait_time = between(1, 3) # Wait 1-3 seconds between requests + + @task(3) # Weight: 3x more likely than other tasks + def calculate_tax(self): + payload = { + "amount": random.uniform(10, 1000), + "zip_code": "94105" + } + self.client.post("/salestax", json=payload) + + @task(1) + def health_check(self): + self.client.get("/health") diff --git a/iac/apps/locust/deployment.yaml b/iac/apps/locust/deployment.yaml new file mode 100644 index 0000000..3246348 --- /dev/null +++ b/iac/apps/locust/deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: locust-master + namespace: default + labels: + app: locust + role: master +spec: + replicas: 1 + selector: + matchLabels: + app: locust + role: master + template: + metadata: + labels: + app: locust + role: master + spec: + containers: + - name: locust + image: locustio/locust:latest + ports: + - containerPort: 8089 + name: web + - containerPort: 5557 + name: master-bind + env: + - name: LOCUST_MODE + value: "master" + - name: LOCUST_HOST + value: "http://labapiserver-service:8080" + volumeMounts: + - name: locustfile + mountPath: /home/locust + volumes: + - name: locustfile + configMap: + name: locust-script +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: locust-worker + namespace: default + labels: + app: locust + role: worker +spec: + replicas: 2 + selector: + matchLabels: + app: locust + role: worker + template: + metadata: + labels: + app: locust + role: worker + spec: + containers: + - name: locust + image: locustio/locust:latest + env: + - name: LOCUST_MODE + value: "worker" + - name: LOCUST_MASTER_NODE_HOST + value: "locust-master-service" + - name: LOCUST_HOST + value: "http://labapiserver-service:8080" + volumeMounts: + - name: locustfile + mountPath: /home/locust + volumes: + - name: locustfile + configMap: + name: locust-script diff --git a/iac/apps/locust/service.yaml b/iac/apps/locust/service.yaml new file mode 100644 index 0000000..6c828e7 --- /dev/null +++ b/iac/apps/locust/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: locust-master-service + namespace: default + labels: + app: locust + role: master +spec: + type: LoadBalancer + ports: + - port: 8089 + targetPort: 8089 + name: web + - port: 5557 + targetPort: 5557 + name: master-bind + selector: + app: locust + role: master diff --git a/iac/argocd/applications/locust-app.yaml b/iac/argocd/applications/locust-app.yaml new file mode 100644 index 0000000..6783ab4 --- /dev/null +++ b/iac/argocd/applications/locust-app.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: locust + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://github.com/mvarshney/labapiserver.git + targetRevision: main + path: iac/app/locust + destination: + server: https://kubernetes.default.svc + namespace: default + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true