re-add agent.conf...
...because it's not worth the necessary overrides/hacks in the base image to remove it.
This commit is contained in:
parent
960311ebd4
commit
cd63a5bc18
21
agents.tf
21
agents.tf
@ -59,15 +59,30 @@ resource "hcloud_server" "agents" {
|
||||
EOT
|
||||
}
|
||||
|
||||
# Generating k3s server config file
|
||||
|
||||
# Generating and uploading the agent.conf file
|
||||
provisioner "file" {
|
||||
content = templatefile("${path.module}/templates/agent.conf.tpl", {
|
||||
server = "https://${local.first_control_plane_network_ip}:6443"
|
||||
token = random_password.k3s_token.result
|
||||
})
|
||||
destination = "/etc/rancher/k3s/agent.conf"
|
||||
|
||||
connection {
|
||||
user = "root"
|
||||
private_key = local.ssh_private_key
|
||||
agent_identity = local.ssh_identity
|
||||
host = self.ipv4_address
|
||||
}
|
||||
}
|
||||
|
||||
# Generating k3s agent config file
|
||||
provisioner "file" {
|
||||
content = yamlencode({
|
||||
node-name = self.name
|
||||
server = "https://${local.first_control_plane_network_ip}:6443"
|
||||
kubelet-arg = "cloud-provider=external"
|
||||
flannel-iface = "eth1"
|
||||
node-ip = local.first_control_plane_network_ip
|
||||
token = random_password.k3s_token.result
|
||||
})
|
||||
destination = "/etc/rancher/k3s/config.yaml"
|
||||
|
||||
|
3
templates/agent.conf.tpl
Normal file
3
templates/agent.conf.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
SERVER_URL="${server}"
|
||||
NODE_TOKEN="${token}"
|
||||
AGENT_OPTS=""
|
Loading…
Reference in New Issue
Block a user