From 14476feb23395c3dddf8566265217679a6c7af07 Mon Sep 17 00:00:00 2001 From: Janik <10290002+led0nk@users.noreply.github.com> Date: Fri, 10 May 2024 22:49:49 +0200 Subject: [PATCH] add k8s.yml / switch to lgtm-stack switch to lgtm stack / add k8s --- guestbook.yaml | 105 ++++++++++++++++++++++++++++++++++ monitoring/podman-compose.yml | 49 +++++----------- 2 files changed, 118 insertions(+), 36 deletions(-) create mode 100644 guestbook.yaml diff --git a/guestbook.yaml b/guestbook.yaml new file mode 100644 index 0000000..800fe26 --- /dev/null +++ b/guestbook.yaml @@ -0,0 +1,105 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "1" + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"guestbook-demo","namespace":"default"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"guestbook-demo"}},"template":{"metadata":{"labels":{"app":"guestbook-demo"}},"spec":{"containers":[{"args":["/guestbook","-addr","0.0.0.0:80","-grpcaddr","lgtm-service.observability:4317","-domain","test.k8s.klimlive.de"],"image":"ghcr.io/led0nk/guestbook:latest","imagePullPolicy":"Always","name":"nginx","ports":[{"containerPort":80}],"volumeMounts":[{"mountPath":"/testdata","name":"testdata-volume"},{"mountPath":"/etc/ssl/certs/ca-certificates.crt","name":"ca-certificates","readOnly":true}]}],"initContainers":[{"command":["/bin/sh","-c","echo '{}' \u003e /testdata/entries.json \u0026\u0026 echo '{}' \u003e /testdata/user.json \u0026\u0026 echo 'EMAIL=\"janik.knodel@gmail.com\"\nSMTPPW=\"qnkx ndoi vmom ezvo\"\nHOST=\"smtp.gmail.com\"\nPORT=\"587\"\nTOKENSECRET=\"secret\"' \u003e /testdata/.env"],"image":"busybox:1.32","name":"create-files","volumeMounts":[{"mountPath":"/testdata","name":"testdata-volume"}]}],"volumes":[{"emptyDir":{},"name":"testdata-volume"},{"hostPath":{"path":"/etc/ssl/certs/ca-certificates.crt"},"name":"ca-certificates"}]}}}} + creationTimestamp: "2024-05-10T19:50:39Z" + generation: 1 + name: guestbook-demo + namespace: default + resourceVersion: "1366" + uid: da0f4fa2-49ca-40c4-a76d-209f07268b8f +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: guestbook-demo + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: guestbook-demo + spec: + containers: + - args: + - /guestbook + - -addr + - 0.0.0.0:80 + - -grpcaddr + - lgtm-service.observability:4317 + - -domain + - test.k8s.klimlive.de + image: ghcr.io/led0nk/guestbook:latest + imagePullPolicy: Always + name: nginx + ports: + - containerPort: 80 + protocol: TCP + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /testdata + name: testdata-volume + - mountPath: /etc/ssl/certs/ca-certificates.crt + name: ca-certificates + readOnly: true + dnsPolicy: ClusterFirst + initContainers: + - command: + - /bin/sh + - -c + - |- + echo '{}' > /testdata/entries.json && echo '{}' > /testdata/user.json && echo 'EMAIL="janik.knodel@gmail.com" + SMTPPW="qnkx ndoi vmom ezvo" + HOST="smtp.gmail.com" + PORT="587" + TOKENSECRET="secret"' > /testdata/.env + image: busybox:1.32 + imagePullPolicy: IfNotPresent + name: create-files + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /testdata + name: testdata-volume + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 + volumes: + - emptyDir: {} + name: testdata-volume + - hostPath: + path: /etc/ssl/certs/ca-certificates.crt + type: "" + name: ca-certificates +status: + availableReplicas: 1 + conditions: + - lastTransitionTime: "2024-05-10T19:50:42Z" + lastUpdateTime: "2024-05-10T19:50:42Z" + message: Deployment has minimum availability. + reason: MinimumReplicasAvailable + status: "True" + type: Available + - lastTransitionTime: "2024-05-10T19:50:39Z" + lastUpdateTime: "2024-05-10T19:50:42Z" + message: ReplicaSet "guestbook-demo-6fdffc7f49" has successfully progressed. + reason: NewReplicaSetAvailable + status: "True" + type: Progressing + observedGeneration: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 diff --git a/monitoring/podman-compose.yml b/monitoring/podman-compose.yml index 24f5f10..4d93c5a 100644 --- a/monitoring/podman-compose.yml +++ b/monitoring/podman-compose.yml @@ -1,48 +1,25 @@ version: "3.5" services: - # Jaeger Tracing for traces - jaeger: + grafana: networks: - backend - image: jaegertracing/all-in-one:latest - volumes: - - "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json:Z" - environment: - - COLECTOR_OTLP_ENABLED=true - - LOG_LEVEL=debug - - METRICS_STORAGE_TYPE=prometheus - - PROMETHEUS_SERVER_URL=http://prometheus:9090 - ports: - - "16686:16686" # Jaeger UI - - "14250:14250" - command: --query.ui-config /etc/jaeger/jaeger-ui.json - - otel_collector: - networks: - - backend - image: otel/opentelemetry-collector-contrib:latest - volumes: - - "./otel-collector-config.yml:/etc/otelcol/otel-collector-config.yml:Z" - command: --config /etc/otelcol/otel-collector-config.yml + image: grafana/otel-lgtm ports: - - "14278:14278" - - "4317:4317" - - "4318:4318" - depends_on: - - jaeger - - # Prometheus Service for metrics - prometheus: + - "127.0.0.1:3000:3000" + - "127.0.0.1:4317:4317" + - "127.0.0.1:4318:4318" + guestbook: networks: - backend - image: prom/prometheus + image: ghcr.io/led0nk/guestbook:latest + command: /guestbook -addr=0.0.0.0:8080 -grpcaddr=grafana:4317 ports: - - "9090:9090" # Prometheus server + - "127.0.0.1:8080:8080" volumes: - - "./prometheus.yml:/etc/prometheus/prometheus.yml:Z" - command: - - "--enable-feature=otlp-write-receiver" - - "--config.file=/etc/prometheus/prometheus.yml" + - "./../testdata:/testdata:Z" networks: backend: + +volumes: + configs: