Repository navigation
Conversation
NetworkPolicy ports match the port on the pod, not the Service port. The rule used service.port and metrics.service.port, so changing either Service port (or containerPorts) left the controller's real ports blocked. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
The NetworkPolicy ingress rule used
service.portandmetrics.service.port. NetworkPolicy ports are matched against the port on the pod (after the Service translates it), so they need to be the container ports. This switches the rule tocontainerPorts.httpandcontainerPorts.metrics, with the same8080/8081fallbacks the Deployment uses.Benefits
With
networkPolicy.enabled: true:service.port: 80(or any Service port other than 8080) renderedport: 80in the policy, so traffic to the controller on 8080 was dropped andkubesealcould not reach it.containerPorts.http/containerPorts.metricswas never reflected in the policy.Possible drawbacks
None expected. With default values the rendered policy is identical (8080/8081 either way).
Applicable issues
Additional information
Checked with
helm template:service.port=80,metrics.service.port=9000: policy had80/9000, now8080/8081(matching the Deployment'scontainerPorts)containerPorts.http=9090,containerPorts.metrics=9091: policy now has9090/9091helm lintandkubeconform -strictpass.