Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kubernetes example for hotrod app #3645

Merged
merged 15 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions examples/hotrod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

highb marked this conversation as resolved.
Show resolved Hide resolved
### Run Jaeger backend

An all-in-one Jaeger backend is packaged as a Docker container with in-memory storage.
Expand Down
17 changes: 17 additions & 0 deletions examples/hotrod/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -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 -
highb marked this conversation as resolved.
Show resolved Hide resolved
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 <http://localhost:16686> and HotROD app at <http://localhost:8080>
40 changes: 40 additions & 0 deletions examples/hotrod/kubernetes/base/hotrod/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions examples/hotrod/kubernetes/base/hotrod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
12 changes: 12 additions & 0 deletions examples/hotrod/kubernetes/base/hotrod/service.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions examples/hotrod/kubernetes/base/jaeger-all-in-one/service.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions examples/hotrod/kubernetes/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions examples/hotrod/kubernetes/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: example-hotrod