diff --git a/examples/hotrod/README.md b/examples/hotrod/README.md index f369f87b704..305096f7fc9 100644 --- a/examples/hotrod/README.md +++ b/examples/hotrod/README.md @@ -28,6 +28,20 @@ to view the traces. A tutorial / walkthrough is available: Alternatively, you can run each component separately as described below. +### Run everything in 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 + +# To cleanup +kustomize build ./kubernetes | kubectl delete -f - +``` + +Access Jaeger UI at http://localhost:16686 and HotROD app at http://localhost:8080 + ### Run Jaeger backend An all-in-one Jaeger backend is packaged as a Docker container with in-memory storage. diff --git a/examples/hotrod/kubernetes/README.md b/examples/hotrod/kubernetes/README.md new file mode 100644 index 00000000000..e58aa2f93a7 --- /dev/null +++ b/examples/hotrod/kubernetes/README.md @@ -0,0 +1,17 @@ +# Hot R.O.D. - Rides on Demand on Kubernetes + +Example k8s manifests for deploying the [hotrod app](..) to your k8s environment of choice. e.g. minikube, k3s, EKS, GKE + +## 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 diff --git a/examples/hotrod/kubernetes/base/hotrod/deployment.yaml b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml new file mode 100644 index 00000000000..420f531816e --- /dev/null +++ b/examples/hotrod/kubernetes/base/hotrod/deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: example-hotrod + name: 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: localhost + - name: JAEGER_AGENT_PORT + value: "6831" + ports: + - containerPort: 8080 + name: frontend + - containerPort: 8081 + name: customer + - containerPort: 8083 + name: route + resources: + limits: + cpu: 100m + memory: 100M + requests: + cpu: 100m + memory: 100M 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/base/hotrod/service.yaml b/examples/hotrod/kubernetes/base/hotrod/service.yaml new file mode 100644 index 00000000000..7ac8a5cd705 --- /dev/null +++ b/examples/hotrod/kubernetes/base/hotrod/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: example-hotrod +spec: + selector: + app: example-hotrod + ports: + - name: frontend + protocol: TCP + port: 8080 + targetPort: frontend 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-all-in-one/service.yaml b/examples/hotrod/kubernetes/base/jaeger-all-in-one/service.yaml new file mode 100644 index 00000000000..e893304eb17 --- /dev/null +++ b/examples/hotrod/kubernetes/base/jaeger-all-in-one/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: jaeger +spec: + selector: + app: example-hotrod + ports: + - name: tracing + protocol: UDP + port: 6831 + targetPort: tracing-jaeger + - name: frontend + protocol: TCP + port: 16686 + targetPort: frontend-jaeger diff --git a/examples/hotrod/kubernetes/kustomization.yaml b/examples/hotrod/kubernetes/kustomization.yaml new file mode 100644 index 00000000000..84859ec2772 --- /dev/null +++ b/examples/hotrod/kubernetes/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +bases: +# If you only want the hotrod application, uncomment this line and comment out jaeger-all-in-one +# - base/hotrod + - base/jaeger + +namespace: example-hotrod + +resources: + - namespace.yaml diff --git a/examples/hotrod/kubernetes/namespace.yaml b/examples/hotrod/kubernetes/namespace.yaml new file mode 100644 index 00000000000..e89d2e0c795 --- /dev/null +++ b/examples/hotrod/kubernetes/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: example-hotrod