Skip to content

Scheduler and controller-manager ports for metrics #791

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

Merged
merged 2 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions data/data/aws/vpc/sg-master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,46 @@ resource "aws_security_group_rule" "master_ingress_internal_from_worker" {
to_port = 9990
}

resource "aws_security_group_rule" "master_ingress_kube_scheduler" {
type = "ingress"
security_group_id = "${aws_security_group.master.id}"

protocol = "tcp"
from_port = 10251
to_port = 10251
self = true
}

resource "aws_security_group_rule" "master_ingress_kube_scheduler_from_worker" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do workers need direct access to the scheduler? This is surprising to me, but I'm not familiar with the scheduler implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(cluster-monitoring) prometheus is running on workers, and prometheus needs to scrape the metrics

Copy link
Member

@wking wking Dec 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and prometheus needs to scrape the metrics

Ugh. Ok. But it really feels like we should get Prometheus and other monitoring out into a different subnet or something then. Having these ports and the 9000-9999 range on all machines open to all workers seems like one more thing to worry about for security. Not something that's going to happen this week though.

Copy link
Contributor

@smarterclayton smarterclayton Dec 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These services are already protected, we need to do a better job of scanning them to catch security regressions though.

We should not be depending on security groups for security. We need to find a way to ensure teams can own both exposing their metrics and securing their metrics. In the core control plane case we've already done that, but we need to keep improving.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be depending on security groups for security.

No, but the more barriers there are between a given bug an a useful exploit, the better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. My understanding is that once the 1.12 rebase lands the masters team will change the secure port to something in the open range (9000-10000).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the default secure ports are 10259 for the scheduler, and 10257 for the controller-manager. As we don't change this for the kubelet, I'd be hesitant to deviate from the defaults for other components.

type = "ingress"
security_group_id = "${aws_security_group.master.id}"
source_security_group_id = "${aws_security_group.worker.id}"

protocol = "tcp"
from_port = 10251
to_port = 10251
}

resource "aws_security_group_rule" "master_ingress_kube_controller_manager" {
type = "ingress"
security_group_id = "${aws_security_group.master.id}"

protocol = "tcp"
from_port = 10252
to_port = 10252
self = true
}

resource "aws_security_group_rule" "master_ingress_kube_controller_manager_from_worker" {
type = "ingress"
security_group_id = "${aws_security_group.master.id}"
source_security_group_id = "${aws_security_group.worker.id}"

protocol = "tcp"
from_port = 10252
to_port = 10252
}

resource "aws_security_group_rule" "master_ingress_kubelet_insecure" {
type = "ingress"
security_group_id = "${aws_security_group.master.id}"
Expand Down
38 changes: 38 additions & 0 deletions data/data/openstack/topology/sg-master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,44 @@ resource "openstack_networking_secgroup_rule_v2" "master_ingress_kubelet_insecur
security_group_id = "${openstack_networking_secgroup_v2.master.id}"
}

resource "openstack_networking_secgroup_rule_v2" "master_ingress_kube_scheduler" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 10251
port_range_max = 10251
security_group_id = "${openstack_networking_secgroup_v2.master.id}"
}

resource "openstack_networking_secgroup_rule_v2" "master_ingress_kube_scheduler_from_worker" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 10251
port_range_max = 10251
remote_group_id = "${openstack_networking_secgroup_v2.worker.id}"
security_group_id = "${openstack_networking_secgroup_v2.master.id}"
}

resource "openstack_networking_secgroup_rule_v2" "master_ingress_kube_controller_manager" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 10252
port_range_max = 10252
security_group_id = "${openstack_networking_secgroup_v2.master.id}"
}

resource "openstack_networking_secgroup_rule_v2" "master_ingress_kube_controller_manager_from_worker" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 10252
port_range_max = 10252
remote_group_id = "${openstack_networking_secgroup_v2.worker.id}"
security_group_id = "${openstack_networking_secgroup_v2.master.id}"
}

resource "openstack_networking_secgroup_rule_v2" "master_ingress_kubelet_secure" {
direction = "ingress"
ethertype = "IPv4"
Expand Down