-
Notifications
You must be signed in to change notification settings - Fork 116
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
Update language around setting Kubernetes pod name in container info #701
Conversation
specs/agents/metadata.md
Outdated
@@ -108,7 +107,9 @@ On Linux, the container ID and some of the Kubernetes metadata can be extracted | |||
|
|||
If we match, then the basename is assumed to be a container ID. | |||
|
|||
If the Kubernetes pod name is not the hostname, it can be overridden by the `KUBERNETES_POD_NAME` environment variable, using the [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/). In a similar manner, you can inform the agent of the node name and namespace, using the environment variables `KUBERNETES_NODE_NAME` and `KUBERNETES_NAMESPACE`. | |||
Sometimes the `KUBERNETES_POD_NAME` is set using the [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/), | |||
so we set the pod name to its value if it exists. Otherwise, we set the pod name to the hostname, because by default, Kubernetes will set the hostname to the pod name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we set the pod name to its value if it exists. Otherwise, we set the pod name to the hostname, because by default, Kubernetes will set the hostname to the pod name. | |
so we set the pod name to its value if it exists. Otherwise, we set the pod name to the hostname, because that's the default value Kubernetes uses. |
4d82638
to
1a82dcb
Compare
specs/agents/metadata.md
Outdated
If the Kubernetes pod name is not the hostname, it can be overridden by the `KUBERNETES_POD_NAME` environment variable, using the [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/). In a similar manner, you can inform the agent of the node name and namespace, using the environment variables `KUBERNETES_NODE_NAME` and `KUBERNETES_NAMESPACE`. | ||
Sometimes the `KUBERNETES_POD_NAME` is set using the [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/), | ||
so we set the pod name to its value if it exists. | ||
In a similar manner, you can inform the agent of the node name and namespace, using the environment variables `KUBERNETES_NODE_NAME` and `KUBERNETES_NAMESPACE`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Perhaps also mention KUBERNETES_POD_UID
to set/override metadata.system.kubernetes.pid.uid
? Though that's adding scope. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the KUBERNETES_POD_UID
to the spec. I don't know why it wasn't mentioned, unless I'm missing some special logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why it wasn't mentioned, unless I'm missing some special logic?
I think it was just overlooked when added. AFAICT all the agents implement reading KUBERNETES_POD_UID
.
b4ac13c
to
924c2ff
Compare
Most agents already set the Kubernetes pod name correctly but the spec language was a bit misleading. This PR makes it more precise how the pod name should be set.