Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 047826f

Browse files
authored
Merge pull request #2062 from splunk/pwilliams-java-tutorial-fix
add yaml indentation and steps to view app in browser
2 parents 71a3116 + ad2c75f commit 047826f

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

gdi/opentelemetry/automatic-discovery/k8s/k8s-java-traces-tutorial/deploy-collector-k8s-java.rst

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,28 @@ Deploy the Spring Petclinic Java application in your Kubernetes cluster:
8080

8181
.. code-block:: yaml
8282
83-
apiVersion: v1
83+
apiVersion: apps/v1
8484
kind: Deployment
8585
metadata:
86-
name: spring-petclinic
87-
namespace: petclinic
86+
name: spring-petclinic
87+
namespace: petclinic
8888
spec:
89-
selector:
90-
matchLabels:
91-
app: spring-petclinic
92-
template:
93-
metadata:
94-
labels:
89+
selector:
90+
matchLabels:
9591
app: spring-petclinic
96-
annotations:
97-
# Activates automatic instrumentation for the Java application
98-
instrumentation.opentelemetry.io/inject-java: "true"
99-
spec:
100-
containers:
101-
- name: petclinic-app
102-
# Java application to instrument
103-
image: ghcr.io/pavolloffay/spring-petclinic:latest
104-
imagePullPolicy: Always
92+
template:
93+
metadata:
94+
labels:
95+
app: spring-petclinic
96+
annotations:
97+
# Activates automatic instrumentation for the Java application
98+
instrumentation.opentelemetry.io/inject-java: "true"
99+
spec:
100+
containers:
101+
- name: petclinic-app
102+
# Java application to instrument
103+
image: ghcr.io/pavolloffay/spring-petclinic:latest
104+
imagePullPolicy: Always
105105
106106
#. Run the following command to start the application deployment:
107107

@@ -166,6 +166,25 @@ The output also shows several ``OTEL`` environment variables:
166166

167167
If you can't see the ``initContainer`` or ``OTEL`` environment, restart your application pod using ``kubectl rollout restart -n petclinic <pod-name>``. The OpenTelemetry Collector pods must be active and running before you deploy your Java application.
168168

169+
Access the Spring PetClinic UI
170+
==============================
171+
172+
Follow these steps to access the Spring PetClinic UI:
173+
174+
#. Create a NodePort service for the ``spring-petclinic`` application:
175+
176+
.. code-block:: bash
177+
178+
kubectl expose deployment/spring-petclinic --type="NodePort" --port 8080
179+
180+
#. Get the NodePort:
181+
182+
.. code-block:: bash
183+
184+
kubectl describe svc spring-petclinic | grep "NodePort"
185+
186+
#. In your browser, navigate to :samp:`http://<host>:<nodeport>`.
187+
169188
Next step
170189
==========================
171190

0 commit comments

Comments
 (0)