'using the Downward API to access multiple container name kubernetes
Is there a programmatic way to get the container name in the pod spec?
I have multiple app containers running in a single POD via Deployment.yaml.
My fluentd instance is running as a sidecar in the deployment. Fluentd needs to collect the logs emitted from these containers. How does it identify a container's name?
The downward API looks promising in this regard. However, the container name is not mentioned in the Capabilities of the Downward API section.
Any workaround solution?
- name: fluentd
image: fluent/fluentd-kubernetes-daemonset:v1-debian-forward
env:
- name: FLUENT_FOWARD_HOST
value: "10.10.132.59"
- name: FLUENT_FOWARD_PORT
value: "24224"
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: K8S_POD
valueFrom:
fieldRef:
fieldPath: metadata.name
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
