Skip to content

Commit 5f2fe57

Browse files
committed
more updates for java istio
1 parent 8df1d5b commit 5f2fe57

File tree

11 files changed

+114
-65
lines changed

11 files changed

+114
-65
lines changed

lab-jaeger-istio-java/istio-java.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ spec:
3434
spec:
3535
containers:
3636
- name: app
37-
image: csantanapr/service-a-java
37+
image: csantanapr/service-a-java-istio
38+
#image: image-registry.openshift-image-registry.svc:5000/default/service-a-java-istio
3839
env:
3940
- name: JAEGER_ENDPOINT
4041
value: http://jaeger-collector.istio-system.svc:14268/api/traces
@@ -81,7 +82,8 @@ spec:
8182
spec:
8283
containers:
8384
- name: app
84-
image: csantanapr/service-b-java
85+
image: csantanapr/service-b-java-istio
86+
#image: image-registry.openshift-image-registry.svc:5000/default/service-b-java-istio
8587
env:
8688
- name: JAEGER_ENDPOINT
8789
value: http://jaeger-collector.istio-system.svc:14268/api/traces

lab-jaeger-istio-nodejs/istio-nodejs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
containers:
3636
- name: app
3737
image: csantanapr/service-a-nodejs-istio
38-
#image: image-registry.openshift-image-registry.svc:5000/default/service-a-nodejs
38+
#image: image-registry.openshift-image-registry.svc:5000/default/service-a-nodejs-istio
3939
env:
4040
- name: JAEGER_ENDPOINT
4141
value: http://jaeger-collector.istio-system.svc:14268/api/traces
@@ -81,7 +81,7 @@ spec:
8181
containers:
8282
- name: app
8383
image: csantanapr/service-b-nodejs-istio
84-
#image: image-registry.openshift-image-registry.svc:5000/default/service-b-nodejs
84+
#image: image-registry.openshift-image-registry.svc:5000/default/service-b-nodejs-istio
8585
env:
8686
- name: JAEGER_ENDPOINT
8787
value: http://jaeger-collector.istio-system.svc:14268/api/traces
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
#docker build . -t default-route-openshift-image-registry.apps-crc.testing/default/service-a-nodejs
4-
#docker push default-route-openshift-image-registry.apps-crc.testing/default/service-a-nodejs
3+
#docker build . -t default-route-openshift-image-registry.apps-crc.testing/default/service-a-nodejs-istio
4+
#docker push default-route-openshift-image-registry.apps-crc.testing/default/service-a-nodejs-istio
55

66
docker build . -t csantanapr/service-a-nodejs-istio
77
docker push csantanapr/service-a-nodejs-istio
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
#docker build . -t default-route-openshift-image-registry.apps-crc.testing/default/service-b-nodejs
4-
#docker push default-route-openshift-image-registry.apps-crc.testing/default/service-b-nodejs
3+
#docker build . -t default-route-openshift-image-registry.apps-crc.testing/default/service-b-nodejs-istio
4+
#docker push default-route-openshift-image-registry.apps-crc.testing/default/service-b-nodejs-istio
55

66
docker build . -t csantanapr/service-b-nodejs-istio
77
docker push csantanapr/service-b-nodejs-istio

modules/ROOT/nav.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* xref:lab-jaeger-nodejs.adoc[Lab 1 Node.js]
44
* xref:lab-jaeger-java.adoc[Lab 2 Java]
55
* xref:ocp-jaeger.adoc[Lab 3 Kubernetes]
6-
* xref:ocp-istio.adoc[Lab 4 Istio Java]
6+
* xref:ocp-istio-java.adoc[Lab 4 Istio Java]
77
* xref:ocp-istio-nodejs.adoc[Lab 5 Istio Node.js]
88
* xref:references.adoc[References]
99

modules/ROOT/pages/ocp-istio.adoc renamed to modules/ROOT/pages/ocp-istio-java.adoc

Lines changed: 101 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
git clone https://github.com/ibm-cloud-architecture/learning-distributed-tracing-101.git
1313
----
1414

15-
. Change to the lab directory
15+
. Change to the lab directory for **Java**
1616
+
1717
[source, bash]
1818
----
19-
cd learning-distrubing-tracing-101.git/lab-jaeger-istio
19+
cd learning-distrubing-tracing-101.git/lab-jaeger-istio-java
2020
----
2121

2222
== Understanding Jaeger, Service Mesh, Kiali
2323

2424
* Read the OpenShift Documentation for:
25-
** https://docs.openshift.com/container-platform/4.1/service_mesh/service_mesh_arch/ossm-jaeger.html[Understanding Jaeger]
26-
** https://docs.openshift.com/container-platform/4.1/service_mesh/service_mesh_arch/understanding-ossm.html[Understanding Service Mesh]
27-
** https://docs.openshift.com/container-platform/4.1/service_mesh/service_mesh_arch/ossm-kiali.html[Understanding Kiali]
25+
** https://docs.openshift.com/container-platform/4.2/service_mesh/service_mesh_arch/ossm-jaeger.html[Understanding Jaeger]
26+
** https://docs.openshift.com/container-platform/4.2/service_mesh/service_mesh_arch/understanding-ossm.html[Understanding Service Mesh]
27+
** https://docs.openshift.com/container-platform/4.2/service_mesh/service_mesh_arch/ossm-kiali.html[Understanding Kiali]
2828

2929
== Installing Service Mesh (Istio) Operator
3030

@@ -38,30 +38,19 @@ With OpenShift 4, you can use the https://cloud.redhat.com/openshift/install/crc
3838
* https://docs.openshift.com/container-platform/4.1/service_mesh/service_mesh_install/preparing-ossm-installation.html[Preparing to install Red Hat OpenShift Service Mesh]
3939
* https://docs.openshift.com/container-platform/4.1/service_mesh/service_mesh_install/installing-ossm.html[Installing Red Hat OpenShift Service Mesh]
4040

41-
[IMPORTANT]
42-
Reducing resources when using local dev crc
43-
====
44-
When creating the ServiceMeshControlPlane edit the yaml for the pilot to specified a lower memory request, the default is 2Gi too high for the crc VM, the pilot section should look this:
45-
[source, yaml]
46-
----
47-
pilot:
48-
autoscaleEnabled: false
49-
traceSampling: 100
50-
resources:
51-
requests:
52-
cpu: 100m
53-
memory: 128Mi
54-
----
55-
56-
====
57-
5841
== Verify Service Mesh installation
5942

6043
. Verify that istio components are installed in the namespace `istio-system`
6144
+
6245
[source, bash]
6346
----
6447
oc get pods -n istio-system
48+
----
49+
+
50+
Verify the output:
51+
+
52+
[source, bash]
53+
----
6554
NAME READY STATUS RESTARTS AGE
6655
grafana-cf5ccd86-dtcl8 2/2 Running 0 2m9s
6756
istio-citadel-7cb44f4bb-hlzdc 1/1 Running 0 5m42s
@@ -82,23 +71,29 @@ prometheus-685bdbdc45-rljkq 2/2 Running 0 5m23s
8271
[source, bash]
8372
----
8473
oc get services -n istio-system
74+
----
75+
+
76+
Verify the output:
77+
+
78+
[source, bash]
79+
----
8580
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
86-
grafana ClusterIP 172.30.247.177 <none> 3000/TCP 16m
87-
istio-citadel ClusterIP 172.30.95.16 <none> 8060/TCP,15014/TCP 20m
88-
istio-egressgateway ClusterIP 172.30.255.61 <none> 80/TCP,443/TCP,15443/TCP 17m
89-
istio-galley ClusterIP 172.30.91.96 <none> 443/TCP,15014/TCP,9901/TCP 19m
90-
istio-ingressgateway ClusterIP 172.30.26.182 <none> 15020/TCP,80/TCP,443/TCP,15443/TCP 17m
91-
istio-pilot ClusterIP 172.30.149.199 <none> 15010/TCP,15011/TCP,8080/TCP,15014/TCP 17m
92-
istio-policy ClusterIP 172.30.22.227 <none> 9091/TCP,15004/TCP,15014/TCP 18m
93-
istio-sidecar-injector ClusterIP 172.30.145.35 <none> 443/TCP 16m
94-
istio-telemetry ClusterIP 172.30.254.60 <none> 9091/TCP,15004/TCP,15014/TCP,42422/TCP 18m
95-
jaeger-agent ClusterIP None <none> 5775/TCP,5778/TCP,6831/TCP,6832/TCP 19m
96-
jaeger-collector ClusterIP 172.30.157.38 <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP 19m
97-
jaeger-collector-headless ClusterIP None <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP 19m
98-
jaeger-query ClusterIP 172.30.15.164 <none> 443/TCP 19m
99-
kiali ClusterIP 172.30.124.111 <none> 20001/TCP 15m
100-
prometheus ClusterIP 172.30.212.70 <none> 9090/TCP 19m
101-
zipkin ClusterIP 172.30.130.27 <none> 9411/TCP 19m
81+
grafana ClusterIP 172.30.100.181 <none> 3000/TCP 21h
82+
istio-citadel ClusterIP 172.30.63.141 <none> 8060/TCP,15014/TCP 21h
83+
istio-egressgateway ClusterIP 172.30.118.88 <none> 80/TCP,443/TCP,15443/TCP 21h
84+
istio-galley ClusterIP 172.30.166.57 <none> 443/TCP,15014/TCP,9901/TCP 21h
85+
istio-ingressgateway ClusterIP 172.30.57.186 <none> 15020/TCP,80/TCP,443/TCP,15443/TCP 21h
86+
istio-pilot ClusterIP 172.30.231.3 <none> 15010/TCP,15011/TCP,8080/TCP,15014/TCP 21h
87+
istio-policy ClusterIP 172.30.118.207 <none> 9091/TCP,15004/TCP,15014/TCP 21h
88+
istio-sidecar-injector ClusterIP 172.30.175.36 <none> 443/TCP 21h
89+
istio-telemetry ClusterIP 172.30.107.108 <none> 9091/TCP,15004/TCP,15014/TCP,42422/TCP 21h
90+
jaeger-agent ClusterIP None <none> 5775/TCP,5778/TCP,6831/TCP,6832/TCP 21h
91+
jaeger-collector ClusterIP 172.30.127.247 <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP 21h
92+
jaeger-collector-headless ClusterIP None <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP 21h
93+
jaeger-query ClusterIP 172.30.215.78 <none> 16686/TCP 21h
94+
kiali NodePort 172.30.46.193 <none> 20001:32087/TCP 21h
95+
prometheus ClusterIP 172.30.5.101 <none> 9090/TCP 21h
96+
zipkin ClusterIP 172.30.62.142 <none> 9411/TCP 21h
10297
----
10398

10499
. Verify that the ServiceMeshMemberRoll includes the target namespace for example `default` as one of the `MEMBERS`
@@ -115,10 +110,16 @@ default [default bookinfo]
115110
[source, bash]
116111
----
117112
oc get route -n istio-system
113+
----
114+
+
115+
Verify the output, make sure `jaeger-query` is using `edge` for tls termination, if not you can use `oc edit service jaeger-query -n istio-system` and change it.
116+
+
117+
[source, bash]
118+
----
118119
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
119120
grafana grafana-istio-system.apps-crc.testing grafana <all> reencrypt None
120121
istio-ingressgateway istio-ingressgateway-istio-system.apps-crc.testing istio-ingressgateway 8080 None
121-
jaeger jaeger-istio-system.apps-crc.testing jaeger-query <all> reencrypt None
122+
jaeger jaeger-istio-system.apps-crc.testing jaeger-query <all> edge None
122123
kiali kiali-istio-system.apps-crc.testing kiali <all> reencrypt None
123124
prometheus prometheus-istio-system.apps-crc.testing prometheus <all> reencrypt None
124125
----
@@ -132,9 +133,9 @@ prometheus prometheus-istio-system.apps-crc.testing
132133

133134
. Deploy the services `service-a` and `service-b`
134135
+
135-
Use the file `jaeger-nodejs.yaml` for Node.js or the file `jaeger-java.yaml` for Java
136+
Use the file `istio-java.yaml` for Java
136137
+
137-
Here is an example using Node.js services:
138+
Here is an example:
138139
+
139140
[source, bash]
140141
----
@@ -145,6 +146,7 @@ Let's look at the file content on how the services are defined to be deploy into
145146
[source, yaml]
146147
----
147148
---
149+
---
148150
apiVersion: v1
149151
kind: Service
150152
metadata:
@@ -180,7 +182,8 @@ spec:
180182
spec:
181183
containers:
182184
- name: app
183-
image: csantanapr/service-a-java
185+
image: csantanapr/service-a-java-istio
186+
#image: image-registry.openshift-image-registry.svc:5000/default/service-a-java-istio
184187
env:
185188
- name: JAEGER_ENDPOINT
186189
value: http://jaeger-collector.istio-system.svc:14268/api/traces
@@ -227,7 +230,8 @@ spec:
227230
spec:
228231
containers:
229232
- name: app
230-
image: csantanapr/service-b-java
233+
image: csantanapr/service-b-java-istio
234+
#image: image-registry.openshift-image-registry.svc:5000/default/service-b-java-istio
231235
env:
232236
- name: JAEGER_ENDPOINT
233237
value: http://jaeger-collector.istio-system.svc:14268/api/traces
@@ -236,7 +240,6 @@ spec:
236240
imagePullPolicy: Always
237241
ports:
238242
- containerPort: 8081
239-
240243
----
241244
+
242245
In the yaml deployment manifest there are few items to point out:
@@ -251,11 +254,10 @@ In the yaml deployment manifest there are few items to point out:
251254
** *Named service ports*
252255
*** The service port name value start with `http`
253256
** **Deployment with app and version labels**
254-
*** THe Pod template should have a unique `app` label, and a `version`
257+
*** THe Pod template should have the following labels defined `app` and `version`
255258

256-
+
257-
The `pom.xml` for each service contains the dependency for zipkin to handle the B3 headers that Istio Envoy proxy forwards, this way allowing for end to end propagation. The dependencies related to opentracing in the file `pom.xml` for the service looks like this:
258259

260+
. The `pom.xml` for each service contains the dependency for zipkin to handle the B3 headers that Istio Envoy proxy forwards, this way allowing for end to end propagation. The dependencies related to opentracing in the file `pom.xml` for the service looks like this:
259261
+
260262
[source, xml]
261263
----
@@ -290,7 +292,45 @@ The `pom.xml` for each service contains the dependency for zipkin to handle the
290292
----
291293
oc apply -f gateway.yaml -n default
292294
----
293-
295+
+
296+
Here is the content of `gateway.yaml`
297+
+
298+
[source, yaml]
299+
----
300+
apiVersion: networking.istio.io/v1alpha3
301+
kind: Gateway
302+
metadata:
303+
name: distributing-tracing-gateway
304+
spec:
305+
selector:
306+
istio: ingressgateway # use istio default controller
307+
servers:
308+
- port:
309+
number: 80
310+
name: http
311+
protocol: HTTP
312+
hosts:
313+
- "*"
314+
---
315+
apiVersion: networking.istio.io/v1alpha3
316+
kind: VirtualService
317+
metadata:
318+
name: distributing-tracing
319+
spec:
320+
hosts:
321+
- "*"
322+
gateways:
323+
- distributing-tracing-gateway
324+
http:
325+
- match:
326+
- uri:
327+
prefix: /sayHello
328+
route:
329+
- destination:
330+
host: service-a
331+
port:
332+
number: 8080
333+
----
294334

295335
. Verify services are deployed and running:
296336
+
@@ -310,7 +350,8 @@ NAME READY UP-TO-DATE AVAILABLE AGE
310350
deployment.apps/service-a 1/1 1 1 6m7s
311351
deployment.apps/service-b 1/1 1 1 6m44s
312352
----
313-
353+
+
354+
Notice that the under the `READY` column for pods, it shows that there are two (2/2) containers running, one of them is the istio side card proxy.
314355

315356
. Get the hostname for the Istio ingress gateway
316357
+
@@ -326,30 +367,36 @@ istio-ingressgateway istio-ingressgateway-istio-system.apps-crc.testing
326367
[source, bash]
327368
----
328369
curl http://istio-ingressgateway-istio-system.apps-crc.testing/sayHello/Carlos
370+
----
371+
+
372+
Notice in the output that the message was formatted by service-b
373+
+
374+
[source, bash]
375+
----
329376
Hello, from service-b Carlos!
330377
----
331378
+
332379
From the result you can see that `service-a` calls `service-b` and replies back.
333380

334381
. In the Jaeger UI select `istio-ingressgateway` or `service-a` and click **Find Traces**
335382
+
336-
image::istio-jaeger-traces.png[]
383+
image::istio-java-jaeger-traces.png[]
337384
+
338385
You can see 7 Spans in a single trace starting from the `istio-ingressgateway` ending in `service-b.default`
339386

340387
. Click on one of the traces and expand the spans in the trace
341388
+
342-
image::istio-jaeger-spans.png[]
389+
image::istio-java-jaeger-spans.png[]
343390
+
344-
Check one of the labs xref:lab-jaeger-nodejs.adoc[Lab Jaeger - Node.js] or xref:lab-jaeger-java.adoc[Lab Jaeger - Java] for a more in depth lab for Opentracing with Jaeger.
391+
Check one of the labs xref:lab-jaeger-nodejs.adoc[Lab Jaeger - Node.js] or xref:lab-java-jaeger-java.adoc[Lab Jaeger - Java] for a more in depth lab for Opentracing with Jaeger.
345392

346393
. In the Kiali UI select Graph to see a topology view of the services, you can enable traffic animation under Display to see the flow of http requests
347394
+
348-
image::istio-kiali.png[]
395+
image::istio-java-kiali.png[]
349396

350397
. In the Grafana UI select the Dashboard *Istio Workload Dashboard* or *Istio Service Dashboard* to see monitoring and metrics data for your services
351398
+
352-
image::istio-grafana.png[]
399+
image::istio-java-grafana.png[]
353400

354401

355402

0 commit comments

Comments
 (0)