Skip to content
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

default-network-dns-policy does not allow access to monitoring port TCP 9153 #909

Closed
Martin-Weiss opened this issue Apr 21, 2021 · 8 comments

Comments

@Martin-Weiss
Copy link

Environmental Info:
RKE2 Version: 1.20.5

Cluster Configuration:
cis-1.5

Describe the bug:
Prometheus alerts show up for dns down.

Steps To Reproduce:
Deploy monitoring on an rke2 cluster with cis1.5 active / network policies active
Check alerts

Expected behavior:
No alert should show up in case dns is up and running well

Actual behavior:
Alert is there because prometheus check to dns pods on 9153 does not work / is blocked by network policy

Workaround:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-network-dns-monitoring-policy
  namespace: kube-system
spec:
  ingress:
  - ports:
    - port: 9153
      protocol: TCP
  podSelector:
    matchLabels:
      k8s-app: kube-dns
  policyTypes:
  - Ingress
@brandond
Copy link
Member

I believe this should go into rancher/rancher. RKE2 isn't responsible for shipping PSPs for every chart; PSPs should be bundled with the apps that require them to function.

@stale
Copy link

stale bot commented Oct 18, 2021

This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 180 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions.

@stale stale bot added the status/stale label Oct 18, 2021
@Martin-Weiss
Copy link
Author

Not stale

@stale stale bot removed the status/stale label Oct 19, 2021
@jayunit100
Copy link

hey was looking at some stuff in this area - and this is an interesting issue - in general, for rke2 do we apply default network policies according to a specification/where are the knobs for controlling them ?

@jayunit100
Copy link

cc @brandond ~ i guess you would know per the PSP stuff - specifically i wanted to see if i could add more default PSPs and NetworkPolicies to RKE2 clusters

@stale
Copy link

stale bot commented Jul 25, 2022

This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 180 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions.

@stale stale bot added the status/stale label Jul 25, 2022
@stale stale bot closed this as completed Aug 12, 2022
@QuinnBast
Copy link

QuinnBast commented Oct 24, 2024

This was never completed, unfortunately.

Also duplicated in #1383

Looking for a workaround to this... I'm not sure how I am supposed to get Prometheus metrics for coredns without this port being added to the network policy

@brandond
Copy link
Member

brandond commented Oct 24, 2024

As discussed above at #909 (comment) and at #1383 (comment) - the monitoring application (the thing doing the scraping) should include PSPs that allow its scrape traffic. It is NOT expected that application monitoring ports would be open to all pods by default, this would be a violation of the principle of least privilege.

I'm not sure how I am supposed to get Prometheus metrics for coredns without this port being added to the network policy

Add a network policy that allows prometheus to access the coredns metrics port? Why would you need to modify the existing one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants