Skip to content

Commit

Permalink
Run kube-apiserver with lower privilege user (nobody)
Browse files Browse the repository at this point in the history
* Change kube-apiserver to always listen on port 6443
* Run kube-apiserver as a non-root user (nobody). User
no longer needs to bind low number ports.
* On most platforms, the kube-apiserver load balancer listens
on 6443 and fronts controllers with kube-apiserver pods using
port 6443. Google Cloud TCP proxy load balancers cannot listen
on 6443. However, GCP's load balancer can be made to listen on
443, while kube-apiserver uses 6443 across all platforms.
  • Loading branch information
dghubble committed Jul 9, 2019
1 parent 7a69bae commit 1c827b1
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Notable changes between versions.
## Latest

* Update Calico from v3.7.3 to [v3.7.4](https://docs.projectcalico.org/v3.7/release-notes/)
* Run `kube-apiserver` with lower privilege user (nobody)

#### Google Cloud

Expand Down
2 changes: 1 addition & 1 deletion aws/container-linux/kubernetes/bootkube.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosted Kubernetes assets (kubeconfig, manifests)
module "bootkube" {
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=95f6fc7fa5f6cedb1a887da3a823b0eeffa40f68"
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=4caca47776dcff440c9f50445fbc8ec5b11728f4"

cluster_name = var.cluster_name
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
Expand Down
2 changes: 1 addition & 1 deletion azure/container-linux/kubernetes/bootkube.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosted Kubernetes assets (kubeconfig, manifests)
module "bootkube" {
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=95f6fc7fa5f6cedb1a887da3a823b0eeffa40f68"
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=4caca47776dcff440c9f50445fbc8ec5b11728f4"

cluster_name = var.cluster_name
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
Expand Down
2 changes: 1 addition & 1 deletion bare-metal/container-linux/kubernetes/bootkube.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosted Kubernetes assets (kubeconfig, manifests)
module "bootkube" {
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=95f6fc7fa5f6cedb1a887da3a823b0eeffa40f68"
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=4caca47776dcff440c9f50445fbc8ec5b11728f4"

cluster_name = var.cluster_name
api_servers = [var.k8s_domain_name]
Expand Down
2 changes: 1 addition & 1 deletion digital-ocean/container-linux/kubernetes/bootkube.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosted Kubernetes assets (kubeconfig, manifests)
module "bootkube" {
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=95f6fc7fa5f6cedb1a887da3a823b0eeffa40f68"
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=4caca47776dcff440c9f50445fbc8ec5b11728f4"

cluster_name = var.cluster_name
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
Expand Down
4 changes: 2 additions & 2 deletions google-cloud/container-linux/kubernetes/apiserver.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resource "google_compute_instance_group" "controllers" {

named_port {
name = "apiserver"
port = "443"
port = "6443"
}

# add instances in the zone into the instance group
Expand All @@ -87,7 +87,7 @@ resource "google_compute_health_check" "apiserver" {
unhealthy_threshold = 3

tcp_health_check {
port = "443"
port = "6443"
}
}

4 changes: 2 additions & 2 deletions google-cloud/container-linux/kubernetes/bootkube.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosted Kubernetes assets (kubeconfig, manifests)
module "bootkube" {
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=95f6fc7fa5f6cedb1a887da3a823b0eeffa40f68"
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=4caca47776dcff440c9f50445fbc8ec5b11728f4"

cluster_name = var.cluster_name
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
Expand All @@ -15,6 +15,6 @@ module "bootkube" {
enable_aggregation = var.enable_aggregation

// temporary
apiserver_port = 443
external_apiserver_port = 443
}

2 changes: 1 addition & 1 deletion google-cloud/container-linux/kubernetes/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ resource "google_compute_firewall" "allow-apiserver" {

allow {
protocol = "tcp"
ports = [443]
ports = [6443]
}

source_ranges = ["0.0.0.0/0"]
Expand Down

0 comments on commit 1c827b1

Please sign in to comment.