Skip to content

Commit 6beb1d5

Browse files
Update APM application linking instructions for Kubernetes
Depends on newrelic/k8s-metadata-injection#701 being merged first, which updates the logging strategy of the k8s-metadata-injection mutating web hook component.
1 parent 9c61662 commit 6beb1d5

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/content/docs/kubernetes-pixie/kubernetes-integration/advanced-configuration/link-apm-applications-kubernetes.mdx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,22 +225,18 @@ Follow these troubleshooting tips as needed.
225225

226226
### Solution
227227

228-
1. Verify that the environment variables are set correctly injected by following the instructions described in the [Validate the injection of metadata](/docs/integrations/kubernetes-integration/metadata-injection/kubernetes-apm-metadata-injection#validate-injection) section.
228+
1. Verify that the environment variables have been correctly injected into new pods by following the instructions described in the [Validate the injection of metadata](/docs/integrations/kubernetes-integration/metadata-injection/kubernetes-apm-metadata-injection#validate-injection) section.
229229

230-
2. If they do not exist, get the name of the metadata injection pod by running:
230+
2. If they do not exist, firstly, tail the logs of the webhook service:
231231

232232
```shell
233-
kubectl get pods | grep newrelic-metadata-injection-deployment
234-
kubectl logs -f pod/my-pod
233+
kubectl logs -l app.kubernetes.io/name=nri-metadata-injection -f
235234
```
236235

237-
3. In another terminal, create a new pod and inspect the logs of the metadata injection deployment for errors. See [Validate the injection of metadata](/docs/integrations/kubernetes-integration/metadata-injection/kubernetes-apm-metadata-injection#validate-injection) section to create a new pod. For each pod created, there should be a set of 4 new entries in the logs, such as:
236+
3. In another terminal, create a new pod and inspect the logs of the metadata injection deployment for errors. See [Validate the injection of metadata](/docs/integrations/kubernetes-integration/metadata-injection/kubernetes-apm-metadata-injection#validate-injection) section to create a new pod. For each pod created, there should be log entry, assuming the [log level (logLevel)](https://github.com/newrelic/k8s-metadata-injection/blob/main/charts/nri-metadata-injection/README.md#values) is at INFO or lower:
238237

239238
```json
240-
{"level":"info","ts":"2020-04-09T12:55:32.107Z","caller":"server/main.go:139","msg":"POST https://newrelic-metadata-injection-svc.default.svc:443/mutate?timeout=30s HTTP/2.0\" from 10.11.49.2:32836"}
241-
{"level":"info","ts":"2020-04-09T12:55:32.110Z","caller":"server/webhook.go:168","msg":"received admission review","kind":"/v1, Kind=Pod","namespace":"default","name":"","pod":"busybox1","UID":"6577519b-7a61-11ea-965e-0e46d1c9335c","operation":"CREATE","userinfo":{"username":"admin","uid":"admin","groups":["system:masters","system:authenticated"]}}
242-
{"level":"info","ts":"2020-04-09T12:55:32.111Z","caller":"server/webhook.go:182","msg":"admission response created","response":"[{\"op\":\"add\",\"path\":\"/spec/containers/0/env\",\"value\":[{\"name\":\"NEW_RELIC_METADATA_KUBERNETES_CLUSTER_NAME\",\"value\":\"adn_kops\"}]},{\"op\":\"add\",\"path\":\"/spec/containers/0/env/-\",\"value\":{\"name\":\"NEW_RELIC_METADATA_KUBERNETES_NODE_NAME\",\"valueFrom\":{\"fieldRef\":{\"fieldPath\":\"spec.nodeName\"}}}},{\"op\":\"add\",\"path\":\"/spec/containers/0/env/-\",\"value\":{\"name\":\"NEW_RELIC_METADATA_KUBERNETES_NAMESPACE_NAME\",\"valueFrom\":{\"fieldRef\":{\"fieldPath\":\"metadata.namespace\"}}}},{\"op\":\"add\",\"path\":\"/spec/containers/0/env/-\",\"value\":{\"name\":\"NEW_RELIC_METADATA_KUBERNETES_POD_NAME\",\"valueFrom\":{\"fieldRef\":{\"fieldPath\":\"metadata.name\"}}}},{\"op\":\"add\",\"path\":\"/spec/containers/0/env/-\",\"value\":{\"name\":\"NEW_RELIC_METADATA_KUBERNETES_CONTAINER_NAME\",\"value\":\"busybox\"}},{\"op\":\"add\",\"path\":\"/spec/containers/0/env/-\",\"value\":{\"name\":\"NEW_RELIC_METADATA_KUBERNETES_CONTAINER_IMAGE_NAME\",\"value\":\"busybox\"}}]"}
243-
{"level":"info","ts":"2020-04-09T12:55:32.111Z","caller":"server/webhook.go:257","msg":"writing response"}
239+
{"level":"info","ts":"2026-02-16T09:58:05.934Z","caller":"server/webhook.go:160","msg":"admission review received","operation":"CREATE","kind":"Pod","namespace":"default","podGenerateName":"test-pod-2-55476b7f5c-","uid":"0b689368-5395-4cda-9b8c-61fa2705f6ee","mutate":true}
244240
```
245241

246242
If there are no new entries in the logs, it means that the API server can't communicate with the webhook service, this could be due to network rules or security groups rejecting the communication.
@@ -289,16 +285,18 @@ Follow these troubleshooting tips as needed.
289285

290286
6. If there are no log entries in either the API server logs or the metadata injection deployment, it means that the webhook was not registered properly.
291287

292-
7. Ensure the metadata injection setup job ran successfully by inspecting the output of this command:
288+
7. Ensure the metadata injection setup jobs ran successfully by inspecting the output of this command:
293289

294290
```shell
295-
kubectl get job newrelic-metadata-setup
291+
kubectl get job nri-metadata-injection-admission-create
292+
kubectl get job nri-metadata-injection-admission-patch
296293
```
297294

298295
8. If the job isn't completed, investigate the logs of the setup job:
299296

300297
```shell
301-
kubectl logs job/newrelic-metadata-setup
298+
kubectl logs job/nri-metadata-injection-admission-create
299+
kubectl logs job/nri-metadata-injection-admission-patch
302300
```
303301

304302
9. Ensure the `CertificateSigningRequest` is approved and issued by running this command:
@@ -310,20 +308,20 @@ Follow these troubleshooting tips as needed.
310308
10. Ensure the TLS secret is present by running this command:
311309

312310
```shell
313-
kubectl get secret newrelic-metadata-injection-secret
311+
kubectl get secret nri-metadata-injection-admission
314312
```
315313

316314
11. Ensure the CA bundle is present in the mutating webhook configuration:
317315

318316
```shell
319-
kubectl get mutatingwebhookconfiguration newrelic-metadata-injection-cfg -o json
317+
kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io nri-metadata-injection -o json
320318
```
321319

322320
12. Ensure the `TargetPort` of the <DNT>**Service**</DNT> resource matches the <DNT>**Port**</DNT> of the <DNT>**Deployment**</DNT>'s container:
323321

324322
```shell
325-
kubectl describe service/newrelic-metadata-injection-svc
326-
kubectl describe deployment/newrelic-metadata-injection-deployment
323+
kubectl describe service/nri-metadata-injection
324+
kubectl describe deployment/nri-metadata-injection
327325
```
328326
</Collapser>
329327
</CollapserGroup>

0 commit comments

Comments
 (0)