Thank you very much Eyal.
I've tried so. I've worked with a simple Java hello world pod app.
But Im trying this one:
https://github.com/digitalocean/kubernetes-sample-apps/tree/master/bookinfo-example
It creates a polyglot app with different pods runnings. Three of them named 'reviews-v1', 'reviews-v2', 'reviews-v3' that run Java apps in WAS.
Im trying so far, to get the APM agent running in the 'reviews-v1' pod.
The service originally looked like this:
apiVersion: apps/v1
kind: Deployment
metadata:
name: reviews-v1
labels:
app: reviews
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: reviews
version: v1
template:
metadata:
labels:
app: reviews
version: v1
spec:
serviceAccountName: bookinfo-reviews
containers:
- name: reviews
image: docker.io/istio/examples-bookinfo-reviews-v1:1.16.4
imagePullPolicy: IfNotPresent
env:
- name: LOG_DIR
value: "/tmp/logs"
ports:
- containerPort: 9080
volumeMounts:
- name: tmp
mountPath: /tmp
- name: wlp-output
mountPath: /opt/ibm/wlp/output
securityContext:
runAsUser: 1000
volumes:
- name: wlp-output
emptyDir: {}
- name: tmp
emptyDir: {}
And I have modified it to look like this:
apiVersion: v1
kind: Service
metadata:
name: reviews
labels:
app: reviews
service: reviews
spec:
ports:
- port: 9080
name: http
selector:
app: reviews
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: bookinfo-reviews
labels:
account: reviews
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: reviews-v1
labels:
app: reviews
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: reviews
version: v1
template:
metadata:
labels:
app: reviews
version: v1
spec:
serviceAccountName: bookinfo-reviews
containers:
- name: reviews
image: docker.io/istio/examples-bookinfo-reviews-v1:1.16.4
imagePullPolicy: IfNotPresent
env:
- name: LOG_DIR
value: "/tmp/logs"
ports:
- containerPort: 9080
volumeMounts:
- name: tmp
mountPath: /tmp
- name: wlp-output
mountPath: /opt/ibm/wlp/output
- name: elastic-apm-agent
mountPath: /elastic/apm/agent
securityContext:
runAsUser: 1000
volumes:
- name: wlp-output
emptyDir: {}
- name: tmp
emptyDir: {}
- name: elastic-apm-agent
emptyDir: {}
initContainers:
- name: elastic-java-agent
image: docker.elastic.co/observability/apm-agent-java:1.12.0
command: ['cp', '-v', '/usr/agent/elastic-apm-agent.jar', '/elastic/apm/agent']
######################### Volume path and agent config ########################### AQUI COMIENZA SEGUNDO AGREGADO
volumeMounts:
- mountPath: /elastic/apm/agent
name: elastic-apm-agent
env:
- name: ELASTIC_APM_SERVER_URL
value: "http://apm-server.eck.svc.cluster.local:8200"
- name: ELASTIC_APM_SERVICE_NAME
value: "bookinfo"
- name: ELASTIC_APM_APPLICATION_PACKAGES
value: "bookinforeview2"
- name: ELASTIC_APM_ENVIRONMENT
value: test
- name: ELASTIC_APM_LOG_LEVEL
value: DEBUG
- name: ELASTIC_APM_SECRET_TOKEN
value: gincol
- name: JAVA_TOOL_OPTIONS
value: -javaagent:/elastic/apm/agent/elastic-apm-agent.jar
The yaml is much bigger but I want to focus in this service.
I know that the env values work as I've set the clinic vet app example running it in a different namespace by using this settings.
But once the app is deployed if I review the logs of the pod:
kubectl logs reviews-v1-7d4f5d97b5-br6bk -n bookinfo
Defaulted container "reviews" out of: reviews, elastic-java-agent (init)
Launching defaultServer (WebSphere Application Server 20.0.0.6/wlp-1.0.41.cl200620200528-0414) on IBM J9 VM, version 8.0.6.16 - pxa6480sr6fp16-20200902_01(SR6 FP16) (en_US)
[AUDIT ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT ] CWWKE0100I: This product is licensed for development, and limited production use. The full license terms can be viewed here: Software License
[AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ibm/wlp/usr/servers/defaultServer/configDropins/defaults/keystore.xml
[AUDIT ] CWWKT0016I: Web application available (default_host): http://reviews-v1-7d4f5d97b5-br6bk:9080/
[AUDIT ] CWWKZ0001I: Application reviews-app started in 0.275 seconds.
[AUDIT ] CWWKF0012I: The server installed the following features: [jaxrs-2.0, jaxrsClient-2.0, json-1.0, jsonp-1.0, servlet-3.1].
[AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 4.024 seconds.
I know that volume with the agent is mounted, as I ssh the pod to check it
And this is where I'm stuck.
So if someone please knows hot to deal with the 'Defaulted container "reviews" out of: reviews, elastic-java-agent (init' error, that would make me happy.
Anyway, thank you very much just for trying. I appreciate it.
Regards.
Carlos T.