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

feat: remove public ipv4 access from worker nodes #12

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 9 additions & 3 deletions modules/hetzner/k3s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ module "k3s" {
workers = {
for i, p in local.k3s_worker_pools : p.pool => {
name = hcloud_server.workers[i].name
node-external-ip = hcloud_server.workers[i].ipv4_address
node-ip = tolist(hcloud_server.workers[i].network)[0].ip
node-external-ip = hcloud_server.workers[i].ipv6_address
node-ip = one(hcloud_server.workers[i].network[*].ip)

connection = {
host = hcloud_server.workers[i].ipv4_address
host = one(hcloud_server.workers[i].network[*].ip)
port = var.ssh_port
private_key = var.ssh_key
user = local.ssh_user

# Always go through the first manager
bastion_host = hcloud_server.manager[0].ipv4_address
bastion_user = local.ssh_user
bastion_private_key = var.ssh_key
bastion_port = var.ssh_port
}
}...
}
Expand Down
10 changes: 8 additions & 2 deletions modules/hetzner/server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ resource "hcloud_server" "workers" {
}

public_net {
ipv4_enabled = true
ipv4_enabled = false
ipv6_enabled = true
}

Expand Down Expand Up @@ -146,11 +146,17 @@ resource "ssh_resource" "manager_ready" {
resource "ssh_resource" "workers_ready" {
count = length(hcloud_server.workers)

host = hcloud_server.workers[count.index].ipv4_address
host = one(hcloud_server.workers[count.index].network[*].ip)
user = local.ssh_user
private_key = var.ssh_key
port = var.ssh_port

# Always go through the first manager
bastion_host = hcloud_server.manager[0].ipv4_address
bastion_user = local.ssh_user
bastion_private_key = var.ssh_key
bastion_port = var.ssh_port

timeout = "5m"
retry_delay = "5s"

Expand Down
Loading