From 2fef2000deb667069eed704437bec4427efcf455 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 11:49:15 -0700 Subject: [PATCH 01/13] Add kubernetes example for hotrod app Signed-off-by: Brandon High --- examples/hotrod/README.md | 9 ++++++ examples/kubernetes/README.md | 13 ++++++++ examples/kubernetes/deployment.yaml | 41 ++++++++++++++++++++++++++ examples/kubernetes/kustomization.yaml | 26 ++++++++++++++++ examples/kubernetes/namespace.yaml | 4 +++ examples/kubernetes/service.yaml | 13 ++++++++ 6 files changed, 106 insertions(+) create mode 100644 examples/kubernetes/README.md create mode 100644 examples/kubernetes/deployment.yaml create mode 100644 examples/kubernetes/kustomization.yaml create mode 100644 examples/kubernetes/namespace.yaml create mode 100644 examples/kubernetes/service.yaml diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index f369f87b704..d7281bd8daf 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -65,6 +65,15 @@ docker run \ Then open http://127.0.0.1:8080 +### Run HotROD from kubernetes + +```bash +kustomize build ../kubernetes | kubectl apply -f - +kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend +``` + +Then open http://127.0.0.1:8080 + ## Metrics The app exposes metrics in either Go's `expvar` format (by default) or in Prometheus format (enabled via `-m prometheus` flag). diff --git a/examples/kubernetes/README.md b/examples/kubernetes/README.md new file mode 100644 index 00000000000..1d64edc5cd1 --- /dev/null +++ b/examples/kubernetes/README.md @@ -0,0 +1,13 @@ +# Hot R.O.D. - Rides on Demand on Kubernetes + +Example k8s manifests for deploying the [hotrod app](../hotrod) to your k8s environment of choice. e.g. minikube, k3s, EKS, GKE + +## Features + +- Optional [example configuration](kustomize.yaml) for using [grafana-agent-traces](https://grafana.com/docs/grafana-cloud/traces/set-up-and-use-tempo/) as a backend. + +## Deploy with Kustomize + +``` +kustomize build . | kubectl apply -f - +``` diff --git a/examples/kubernetes/deployment.yaml b/examples/kubernetes/deployment.yaml new file mode 100644 index 00000000000..61f5b33ce4f --- /dev/null +++ b/examples/kubernetes/deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: example-hotrod + name: example-hotrod + namespace: example-hotrod +spec: + replicas: 1 + selector: + matchLabels: + app: example-hotrod + strategy: {} + template: + metadata: + labels: + app: example-hotrod + spec: + containers: + - image: jaegertracing/example-hotrod:latest + name: example-hotrod + args: ["all"] + env: + - name: JAEGER_AGENT_HOST + value: jaeger.jaeger.svc.cluster.local + - name: JAEGER_AGENT_PORT + value: "6831" + ports: + - containerPort: 8080 + name: frontend + - containerPort: 8081 + name: customer + - containerPort: 8083 + name: route + resources: + limits: + cpu: 250m + memory: 1G + requests: + cpu: 100m + memory: 1G diff --git a/examples/kubernetes/kustomization.yaml b/examples/kubernetes/kustomization.yaml new file mode 100644 index 00000000000..f66ee0636a3 --- /dev/null +++ b/examples/kubernetes/kustomization.yaml @@ -0,0 +1,26 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - namespace.yaml + - deployment.yaml + - service.yaml + +# If you want to use the grafana-agent, uncomment below. +# patches: +# - target: +# group: apps +# version: v1 +# kind: Deployment +# name: example-hotrod +# patch: |- +# - op: add +# path: /spec/template/spec/containers/0/env/- +# value: +# name: JAEGER_AGENT_HOST +# value: grafana-agent-traces.grafana.svc.cluster.local +# - op: add +# path: /spec/template/spec/containers/0/env/- +# value: +# name: JAEGER_AGENT_PORT +# value: "6831" diff --git a/examples/kubernetes/namespace.yaml b/examples/kubernetes/namespace.yaml new file mode 100644 index 00000000000..e89d2e0c795 --- /dev/null +++ b/examples/kubernetes/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: example-hotrod diff --git a/examples/kubernetes/service.yaml b/examples/kubernetes/service.yaml new file mode 100644 index 00000000000..14141069b2d --- /dev/null +++ b/examples/kubernetes/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: example-hotrod + namespace: example-hotrod +spec: + selector: + app: example-hotrod + ports: + - name: frontend + protocol: TCP + port: 8080 + targetPort: 8080 From 172e9be811092d512c15b7c7bcfad0593b6f8714 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 12:11:23 -0700 Subject: [PATCH 02/13] Remove grafana-agent optional configuration Signed-off-by: Brandon High --- examples/kubernetes/README.md | 4 ---- examples/kubernetes/kustomization.yaml | 19 ------------------- 2 files changed, 23 deletions(-) diff --git a/examples/kubernetes/README.md b/examples/kubernetes/README.md index 1d64edc5cd1..c270731d81e 100644 --- a/examples/kubernetes/README.md +++ b/examples/kubernetes/README.md @@ -2,10 +2,6 @@ Example k8s manifests for deploying the [hotrod app](../hotrod) to your k8s environment of choice. e.g. minikube, k3s, EKS, GKE -## Features - -- Optional [example configuration](kustomize.yaml) for using [grafana-agent-traces](https://grafana.com/docs/grafana-cloud/traces/set-up-and-use-tempo/) as a backend. - ## Deploy with Kustomize ``` diff --git a/examples/kubernetes/kustomization.yaml b/examples/kubernetes/kustomization.yaml index f66ee0636a3..a8779db63ea 100644 --- a/examples/kubernetes/kustomization.yaml +++ b/examples/kubernetes/kustomization.yaml @@ -5,22 +5,3 @@ resources: - namespace.yaml - deployment.yaml - service.yaml - -# If you want to use the grafana-agent, uncomment below. -# patches: -# - target: -# group: apps -# version: v1 -# kind: Deployment -# name: example-hotrod -# patch: |- -# - op: add -# path: /spec/template/spec/containers/0/env/- -# value: -# name: JAEGER_AGENT_HOST -# value: grafana-agent-traces.grafana.svc.cluster.local -# - op: add -# path: /spec/template/spec/containers/0/env/- -# value: -# name: JAEGER_AGENT_PORT -# value: "6831" From 050f26e74daa05368c7ace760a292c8dc7239f59 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 12:13:40 -0700 Subject: [PATCH 03/13] Add redis container to kubernetes deployment example Also reduces the cpu/memory limits as they were excessive initially. Signed-off-by: Brandon High --- examples/kubernetes/deployment.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/examples/kubernetes/deployment.yaml b/examples/kubernetes/deployment.yaml index 61f5b33ce4f..3545e8293be 100644 --- a/examples/kubernetes/deployment.yaml +++ b/examples/kubernetes/deployment.yaml @@ -34,8 +34,20 @@ spec: name: route resources: limits: - cpu: 250m - memory: 1G + cpu: 100m + memory: 100M + requests: + cpu: 100m + memory: 100M + - image: redis:latest + name: redis + ports: + - containerPort: 6379 + name: redis + resources: + limits: + cpu: 100m + memory: 50M requests: cpu: 100m - memory: 1G + memory: 50M From 43143cbe1ac0c5fdf1c0263169ef9c0edaf8a0c4 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 12:14:56 -0700 Subject: [PATCH 04/13] Move kubernetes example into hotrod/kubernetes Signed-off-by: Brandon High --- examples/{ => hotrod}/kubernetes/README.md | 0 examples/{ => hotrod}/kubernetes/deployment.yaml | 0 examples/{ => hotrod}/kubernetes/kustomization.yaml | 0 examples/{ => hotrod}/kubernetes/namespace.yaml | 0 examples/{ => hotrod}/kubernetes/service.yaml | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename examples/{ => hotrod}/kubernetes/README.md (100%) rename examples/{ => hotrod}/kubernetes/deployment.yaml (100%) rename examples/{ => hotrod}/kubernetes/kustomization.yaml (100%) rename examples/{ => hotrod}/kubernetes/namespace.yaml (100%) rename examples/{ => hotrod}/kubernetes/service.yaml (100%) diff --git a/examples/kubernetes/README.md b/examples/hotrod/kubernetes/README.md similarity index 100% rename from examples/kubernetes/README.md rename to examples/hotrod/kubernetes/README.md diff --git a/examples/kubernetes/deployment.yaml b/examples/hotrod/kubernetes/deployment.yaml similarity index 100% rename from examples/kubernetes/deployment.yaml rename to examples/hotrod/kubernetes/deployment.yaml diff --git a/examples/kubernetes/kustomization.yaml b/examples/hotrod/kubernetes/kustomization.yaml similarity index 100% rename from examples/kubernetes/kustomization.yaml rename to examples/hotrod/kubernetes/kustomization.yaml diff --git a/examples/kubernetes/namespace.yaml b/examples/hotrod/kubernetes/namespace.yaml similarity index 100% rename from examples/kubernetes/namespace.yaml rename to examples/hotrod/kubernetes/namespace.yaml diff --git a/examples/kubernetes/service.yaml b/examples/hotrod/kubernetes/service.yaml similarity index 100% rename from examples/kubernetes/service.yaml rename to examples/hotrod/kubernetes/service.yaml From 5bc3a7cdcbac54751683bd576998e3b68522e697 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 12:35:59 -0700 Subject: [PATCH 05/13] Add jaeger all-in-one to kubernetes example Signed-off-by: Brandon High --- examples/hotrod/README.md | 2 +- examples/hotrod/kubernetes/README.md | 2 +- .../{ => base/hotrod}/deployment.yaml | 3 +- .../kubernetes/base/hotrod/kustomization.yaml | 6 ++++ .../kubernetes/{ => base/hotrod}/service.yaml | 3 +- .../kubernetes/base/jaeger/deployment.yaml | 32 +++++++++++++++++++ .../kubernetes/base/jaeger/kustomization.yaml | 6 ++++ .../kubernetes/base/jaeger/service.yaml | 16 ++++++++++ examples/hotrod/kubernetes/kustomization.yaml | 8 +++-- 9 files changed, 70 insertions(+), 8 deletions(-) rename examples/hotrod/kubernetes/{ => base/hotrod}/deployment.yaml (93%) create mode 100644 examples/hotrod/kubernetes/base/hotrod/kustomization.yaml rename examples/hotrod/kubernetes/{ => base/hotrod}/service.yaml (77%) create mode 100644 examples/hotrod/kubernetes/base/jaeger/deployment.yaml create mode 100644 examples/hotrod/kubernetes/base/jaeger/kustomization.yaml create mode 100644 examples/hotrod/kubernetes/base/jaeger/service.yaml diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index d7281bd8daf..9875b866ade 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -68,7 +68,7 @@ Then open http://127.0.0.1:8080 ### Run HotROD from kubernetes ```bash -kustomize build ../kubernetes | kubectl apply -f - +kustomize build kubernetes | kubectl apply -f - kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend ``` diff --git a/examples/hotrod/kubernetes/README.md b/examples/hotrod/kubernetes/README.md index c270731d81e..bd7b8da63ed 100644 --- a/examples/hotrod/kubernetes/README.md +++ b/examples/hotrod/kubernetes/README.md @@ -1,6 +1,6 @@ # Hot R.O.D. - Rides on Demand on Kubernetes -Example k8s manifests for deploying the [hotrod app](../hotrod) to your k8s environment of choice. e.g. minikube, k3s, EKS, GKE +Example k8s manifests for deploying the [hotrod app](..) to your k8s environment of choice. e.g. minikube, k3s, EKS, GKE ## Deploy with Kustomize diff --git a/examples/hotrod/kubernetes/deployment.yaml b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml similarity index 93% rename from examples/hotrod/kubernetes/deployment.yaml rename to examples/hotrod/kubernetes/base/hotrod/deployment.yaml index 3545e8293be..7d2c5b542f3 100644 --- a/examples/hotrod/kubernetes/deployment.yaml +++ b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml @@ -4,7 +4,6 @@ metadata: labels: app: example-hotrod name: example-hotrod - namespace: example-hotrod spec: replicas: 1 selector: @@ -22,7 +21,7 @@ spec: args: ["all"] env: - name: JAEGER_AGENT_HOST - value: jaeger.jaeger.svc.cluster.local + value: jaeger.example-hotrod.svc.cluster.local - name: JAEGER_AGENT_PORT value: "6831" ports: diff --git a/examples/hotrod/kubernetes/base/hotrod/kustomization.yaml b/examples/hotrod/kubernetes/base/hotrod/kustomization.yaml new file mode 100644 index 00000000000..5b98e944923 --- /dev/null +++ b/examples/hotrod/kubernetes/base/hotrod/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - deployment.yaml + - service.yaml diff --git a/examples/hotrod/kubernetes/service.yaml b/examples/hotrod/kubernetes/base/hotrod/service.yaml similarity index 77% rename from examples/hotrod/kubernetes/service.yaml rename to examples/hotrod/kubernetes/base/hotrod/service.yaml index 14141069b2d..7ac8a5cd705 100644 --- a/examples/hotrod/kubernetes/service.yaml +++ b/examples/hotrod/kubernetes/base/hotrod/service.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: example-hotrod - namespace: example-hotrod spec: selector: app: example-hotrod @@ -10,4 +9,4 @@ spec: - name: frontend protocol: TCP port: 8080 - targetPort: 8080 + targetPort: frontend diff --git a/examples/hotrod/kubernetes/base/jaeger/deployment.yaml b/examples/hotrod/kubernetes/base/jaeger/deployment.yaml new file mode 100644 index 00000000000..848c0aa3d73 --- /dev/null +++ b/examples/hotrod/kubernetes/base/jaeger/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: jaeger + name: jaeger +spec: + replicas: 1 + selector: + matchLabels: + app: jaeger + strategy: {} + template: + metadata: + labels: + app: jaeger + spec: + containers: + - image: jaegertracing/all-in-one:latest + name: jaeger + ports: + - containerPort: 6831 + name: tracing + - containerPort: 16686 + name: frontend + resources: + limits: + cpu: 100m + memory: 100M + requests: + cpu: 100m + memory: 100M diff --git a/examples/hotrod/kubernetes/base/jaeger/kustomization.yaml b/examples/hotrod/kubernetes/base/jaeger/kustomization.yaml new file mode 100644 index 00000000000..5b98e944923 --- /dev/null +++ b/examples/hotrod/kubernetes/base/jaeger/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - deployment.yaml + - service.yaml diff --git a/examples/hotrod/kubernetes/base/jaeger/service.yaml b/examples/hotrod/kubernetes/base/jaeger/service.yaml new file mode 100644 index 00000000000..ac15491d5a0 --- /dev/null +++ b/examples/hotrod/kubernetes/base/jaeger/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: jaeger +spec: + selector: + app: jaeger + ports: + - name: tracing + protocol: TCP + port: 6831 + targetPort: tracing + - name: frontend + protocol: TCP + port: 16686 + targetPort: frontend diff --git a/examples/hotrod/kubernetes/kustomization.yaml b/examples/hotrod/kubernetes/kustomization.yaml index a8779db63ea..c9ab8136a6e 100644 --- a/examples/hotrod/kubernetes/kustomization.yaml +++ b/examples/hotrod/kubernetes/kustomization.yaml @@ -1,7 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +bases: + - base/hotrod + - base/jaeger + +namespace: example-hotrod + resources: - namespace.yaml - - deployment.yaml - - service.yaml From 7eeefea09f37da3f57deffbccdbfdc8f6cc616d3 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 12:46:05 -0700 Subject: [PATCH 06/13] Add one-liner for port-forward to see traces Signed-off-by: Brandon High --- examples/hotrod/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index 9875b866ade..1009bef4380 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -65,11 +65,13 @@ docker run \ Then open http://127.0.0.1:8080 -### Run HotROD from kubernetes +### Run HotROD/Jaeger all-in-one from kubernetes ```bash kustomize build kubernetes | kubectl apply -f - kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend +# In another terminal +kubectl port-forward -n example-hotrod service/jaeger 16686:frontend ``` Then open http://127.0.0.1:8080 From 744a4cc14fc9890717b06d1b1c98667954ff410f Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 12:48:51 -0700 Subject: [PATCH 07/13] Tracing port needs to be UDP not TCP Signed-off-by: Brandon High --- examples/hotrod/kubernetes/base/jaeger/service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hotrod/kubernetes/base/jaeger/service.yaml b/examples/hotrod/kubernetes/base/jaeger/service.yaml index ac15491d5a0..9c30260dd3c 100644 --- a/examples/hotrod/kubernetes/base/jaeger/service.yaml +++ b/examples/hotrod/kubernetes/base/jaeger/service.yaml @@ -7,7 +7,7 @@ spec: app: jaeger ports: - name: tracing - protocol: TCP + protocol: UDP port: 6831 targetPort: tracing - name: frontend From 8af336cb0a14e9438a6a8c3c53052a0a8b2d5c05 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 13:30:29 -0700 Subject: [PATCH 08/13] Update examples/hotrod/README.md Co-authored-by: Yuri Shkuro Signed-off-by: Brandon High --- examples/hotrod/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index 1009bef4380..a773e1c8796 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -68,7 +68,7 @@ Then open http://127.0.0.1:8080 ### Run HotROD/Jaeger all-in-one from kubernetes ```bash -kustomize build kubernetes | kubectl apply -f - +kustomize build ./kubernetes | kubectl apply -f - kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend # In another terminal kubectl port-forward -n example-hotrod service/jaeger 16686:frontend From 084a43ca2dec4e9566be44c5e928f570d213c649 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 13:33:04 -0700 Subject: [PATCH 09/13] Move up kubernetes section in hotrod example README Signed-off-by: Brandon High --- examples/hotrod/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index a773e1c8796..c048b561821 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -28,6 +28,17 @@ to view the traces. A tutorial / walkthrough is available: Alternatively, you can run each component separately as described below. +### Run HotROD/Jaeger all-in-one from kubernetes + +```bash +kustomize build ./kubernetes | kubectl apply -f - +kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend +# In another terminal +kubectl port-forward -n example-hotrod service/jaeger 16686:frontend +``` + +Then open + ### Run Jaeger backend An all-in-one Jaeger backend is packaged as a Docker container with in-memory storage. @@ -65,17 +76,6 @@ docker run \ Then open http://127.0.0.1:8080 -### Run HotROD/Jaeger all-in-one from kubernetes - -```bash -kustomize build ./kubernetes | kubectl apply -f - -kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend -# In another terminal -kubectl port-forward -n example-hotrod service/jaeger 16686:frontend -``` - -Then open http://127.0.0.1:8080 - ## Metrics The app exposes metrics in either Go's `expvar` format (by default) or in Prometheus format (enabled via `-m prometheus` flag). From 2785a9a5db002d36b9d1f90656a4f348fb98fcd1 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 16:18:20 -0700 Subject: [PATCH 10/13] Apply suggestions from code review Co-authored-by: Yuri Shkuro Signed-off-by: Brandon High --- examples/hotrod/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index c048b561821..e944b94a9f9 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -28,7 +28,7 @@ to view the traces. A tutorial / walkthrough is available: Alternatively, you can run each component separately as described below. -### Run HotROD/Jaeger all-in-one from kubernetes +### Run everything in Kubernetes ```bash kustomize build ./kubernetes | kubectl apply -f - @@ -37,7 +37,7 @@ kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend kubectl port-forward -n example-hotrod service/jaeger 16686:frontend ``` -Then open +Access Jaeger UI at http://localhost:16686 and HotROD app at http://localhost:8080 ### Run Jaeger backend From cb16a3d6e45f57aae88720796cd28bb3809506dc Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 16:21:33 -0700 Subject: [PATCH 11/13] Add cleanup to k8s example READMEs Signed-off-by: Brandon High --- examples/hotrod/README.md | 3 +++ examples/hotrod/kubernetes/README.md | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index e944b94a9f9..305096f7fc9 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -35,6 +35,9 @@ kustomize build ./kubernetes | kubectl apply -f - kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend # In another terminal kubectl port-forward -n example-hotrod service/jaeger 16686:frontend + +# To cleanup +kustomize build ./kubernetes | kubectl delete -f - ``` Access Jaeger UI at http://localhost:16686 and HotROD app at http://localhost:8080 diff --git a/examples/hotrod/kubernetes/README.md b/examples/hotrod/kubernetes/README.md index bd7b8da63ed..e58aa2f93a7 100644 --- a/examples/hotrod/kubernetes/README.md +++ b/examples/hotrod/kubernetes/README.md @@ -2,8 +2,16 @@ Example k8s manifests for deploying the [hotrod app](..) to your k8s environment of choice. e.g. minikube, k3s, EKS, GKE -## Deploy with Kustomize +## Usage -``` +```bash kustomize build . | kubectl apply -f - +kubectl port-forward -n example-hotrod service/example-hotrod 8080:frontend +# In another terminal +kubectl port-forward -n example-hotrod service/jaeger 16686:frontend + +# To cleanup +kustomize build . | kubectl delete -f - ``` + +Access Jaeger UI at and HotROD app at From c16461077b41b29daaee23f4c7ee52ee95092319 Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 16:23:10 -0700 Subject: [PATCH 12/13] Remove redis from hotrod example Signed-off-by: Brandon High --- .../hotrod/kubernetes/base/hotrod/deployment.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/examples/hotrod/kubernetes/base/hotrod/deployment.yaml b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml index 7d2c5b542f3..840324afc59 100644 --- a/examples/hotrod/kubernetes/base/hotrod/deployment.yaml +++ b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml @@ -38,15 +38,3 @@ spec: requests: cpu: 100m memory: 100M - - image: redis:latest - name: redis - ports: - - containerPort: 6379 - name: redis - resources: - limits: - cpu: 100m - memory: 50M - requests: - cpu: 100m - memory: 50M From 9a5fc7f7937591b642f9f430fe95e957b2b860fb Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 26 Apr 2022 16:55:10 -0700 Subject: [PATCH 13/13] Use pod local/localhost for jaeger-all-in-one Signed-off-by: Brandon High --- .../kubernetes/base/hotrod/deployment.yaml | 2 +- .../base/jaeger-all-in-one/kustomization.yaml | 33 +++++++++++++++++++ .../service.yaml | 6 ++-- .../kubernetes/base/jaeger/deployment.yaml | 32 ------------------ .../kubernetes/base/jaeger/kustomization.yaml | 6 ---- examples/hotrod/kubernetes/kustomization.yaml | 3 +- 6 files changed, 39 insertions(+), 43 deletions(-) create mode 100644 examples/hotrod/kubernetes/base/jaeger-all-in-one/kustomization.yaml rename examples/hotrod/kubernetes/base/{jaeger => jaeger-all-in-one}/service.yaml (68%) delete mode 100644 examples/hotrod/kubernetes/base/jaeger/deployment.yaml delete mode 100644 examples/hotrod/kubernetes/base/jaeger/kustomization.yaml diff --git a/examples/hotrod/kubernetes/base/hotrod/deployment.yaml b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml index 840324afc59..420f531816e 100644 --- a/examples/hotrod/kubernetes/base/hotrod/deployment.yaml +++ b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml @@ -21,7 +21,7 @@ spec: args: ["all"] env: - name: JAEGER_AGENT_HOST - value: jaeger.example-hotrod.svc.cluster.local + value: localhost - name: JAEGER_AGENT_PORT value: "6831" ports: diff --git a/examples/hotrod/kubernetes/base/jaeger-all-in-one/kustomization.yaml b/examples/hotrod/kubernetes/base/jaeger-all-in-one/kustomization.yaml new file mode 100644 index 00000000000..e64e7bb96d3 --- /dev/null +++ b/examples/hotrod/kubernetes/base/jaeger-all-in-one/kustomization.yaml @@ -0,0 +1,33 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +bases: + - ../hotrod + +resources: + - service.yaml + +patches: + - target: + group: apps + version: v1 + kind: Deployment + name: example-hotrod + patch: |- + - op: add + path: /spec/template/spec/containers/- + value: + image: jaegertracing/all-in-one:latest + name: jaeger + ports: + - containerPort: 6831 + name: tracing-jaeger + - containerPort: 16686 + name: frontend-jaeger + resources: + limits: + cpu: 100m + memory: 100M + requests: + cpu: 100m + memory: 100M diff --git a/examples/hotrod/kubernetes/base/jaeger/service.yaml b/examples/hotrod/kubernetes/base/jaeger-all-in-one/service.yaml similarity index 68% rename from examples/hotrod/kubernetes/base/jaeger/service.yaml rename to examples/hotrod/kubernetes/base/jaeger-all-in-one/service.yaml index 9c30260dd3c..e893304eb17 100644 --- a/examples/hotrod/kubernetes/base/jaeger/service.yaml +++ b/examples/hotrod/kubernetes/base/jaeger-all-in-one/service.yaml @@ -4,13 +4,13 @@ metadata: name: jaeger spec: selector: - app: jaeger + app: example-hotrod ports: - name: tracing protocol: UDP port: 6831 - targetPort: tracing + targetPort: tracing-jaeger - name: frontend protocol: TCP port: 16686 - targetPort: frontend + targetPort: frontend-jaeger diff --git a/examples/hotrod/kubernetes/base/jaeger/deployment.yaml b/examples/hotrod/kubernetes/base/jaeger/deployment.yaml deleted file mode 100644 index 848c0aa3d73..00000000000 --- a/examples/hotrod/kubernetes/base/jaeger/deployment.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: jaeger - name: jaeger -spec: - replicas: 1 - selector: - matchLabels: - app: jaeger - strategy: {} - template: - metadata: - labels: - app: jaeger - spec: - containers: - - image: jaegertracing/all-in-one:latest - name: jaeger - ports: - - containerPort: 6831 - name: tracing - - containerPort: 16686 - name: frontend - resources: - limits: - cpu: 100m - memory: 100M - requests: - cpu: 100m - memory: 100M diff --git a/examples/hotrod/kubernetes/base/jaeger/kustomization.yaml b/examples/hotrod/kubernetes/base/jaeger/kustomization.yaml deleted file mode 100644 index 5b98e944923..00000000000 --- a/examples/hotrod/kubernetes/base/jaeger/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: - - deployment.yaml - - service.yaml diff --git a/examples/hotrod/kubernetes/kustomization.yaml b/examples/hotrod/kubernetes/kustomization.yaml index c9ab8136a6e..84859ec2772 100644 --- a/examples/hotrod/kubernetes/kustomization.yaml +++ b/examples/hotrod/kubernetes/kustomization.yaml @@ -2,7 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization bases: - - base/hotrod +# If you only want the hotrod application, uncomment this line and comment out jaeger-all-in-one +# - base/hotrod - base/jaeger namespace: example-hotrod