feat : enable support for "hostNetwork" in Prometheus CRD#5010
Conversation
|
Failing build of "checks / Check Documentation formatting and links (pull_request)" is unrelated, i checked it is failing while opening a link which is taking long time while opening. |
|
There is already discussion around |
simonpasquier
left a comment
There was a problem hiding this comment.
I've never used hostNetwork: true but I think that the operator needs to modify the container's ports defintion.
From the ContainerPort documentation:
hostPort | Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.
26a5ac6 to
6cf8204
Compare
HI @simonpasquier , Please see the example at https://gist.github.com/Rajpratik71/632321a6fb8c6acc17593e2c887c45a9 When we specify "hostNetwork" for the Pod, there is no need to specify the "hostPort" seperately as when using "hostNetwork" , whole network namespace of Host will be shared, which will also expose the port. See, below Although, "hostNetwork" requires "dnsPolicy" to be set as "ClusterFirstWithHostNet". So, raised a PR #5027 to "enable support for "dnsPolicy" in Prometheus CRD". |
After reviewing more carefully, I realize that we may not need to expose dnsPolicy in the CRD. If I understand correctly, |
Hi @simonpasquier , I created #5027 for the same purpose to configure the dnsPolicy . When it will get merged , i will rebase this branch to automate the process of setting "dnsPolicy" to "ClusterFirstWithHostNet" in case of "hostNetwork". |
|
Sorry if I wasn't clear but my question is: do we need #5027 at all? What if the operator is the only one responsible for setting dnsPolicy?
|
d673245 to
acb34d6
Compare
simonpasquier
left a comment
There was a problem hiding this comment.
can you add a unit test with "hostNetwork: true"?
acb34d6 to
f88810b
Compare
Enabled support for "hostNetwork" in Prometheus Operator Needed in many scenarios like: 1. To bypass the CNI network 2. In general to reduce the metrics traffic overhead on CNI network in clusters with large no of Nodes. Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
f88810b to
0b343dd
Compare
Hi @simonpasquier , added the test for "hostNetwork: true". Also, tested the "dnsPolicy" . it is working fine as expected. |
…s" CR Object fixes prometheus-community#2689 Released in [v0.60.0](https://github.com/prometheus-operator/prometheus-operator/releases/tag/v0.60.0) Added at [feat : enable support for "hostNetwork" in Prometheus CRD](prometheus-operator/prometheus-operator#5010) Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
…s" CR Object fixes prometheus-community#2689 Released in [v0.60.0](https://github.com/prometheus-operator/prometheus-operator/releases/tag/v0.60.0) Added at [feat : enable support for "hostNetwork" in Prometheus CRD](prometheus-operator/prometheus-operator#5010) Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
…s" CR Object (#2693) fixes #2689 Released in [v0.60.0](https://github.com/prometheus-operator/prometheus-operator/releases/tag/v0.60.0) Added at [feat : enable support for "hostNetwork" in Prometheus CRD](prometheus-operator/prometheus-operator#5010) Signed-off-by: Pratik Raj <rajpratik71@gmail.com> Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
…s" CR Object (prometheus-community#2693) fixes prometheus-community#2689 Released in [v0.60.0](https://github.com/prometheus-operator/prometheus-operator/releases/tag/v0.60.0) Added at [feat : enable support for "hostNetwork" in Prometheus CRD](prometheus-operator/prometheus-operator#5010) Signed-off-by: Pratik Raj <rajpratik71@gmail.com> Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
…s" CR Object (#2693) fixes #2689 Released in [v0.60.0](https://github.com/prometheus-operator/prometheus-operator/releases/tag/v0.60.0) Added at [feat : enable support for "hostNetwork" in Prometheus CRD](prometheus-operator/prometheus-operator#5010) Signed-off-by: Pratik Raj <rajpratik71@gmail.com> Signed-off-by: Pratik Raj <rajpratik71@gmail.com>


Description
Enabled support for "hostNetwork" in Prometheus Operator for Prometheus
Needed in many scenarios like:
Signed-off-by: Pratik Raj rajpratik71@gmail.com
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
xin the box that apply.CHANGE(fix or feature that would cause existing functionality to not work as expected)FEATURE(non-breaking change which adds functionality)BUGFIX(non-breaking change which fixes an issue)ENHANCEMENT(non-breaking change which improves existing functionality)NONE(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.
Fixes #2630