Skip to content

Commit f330d35

Browse files
committed
fix(iac): K3s - fix kubeconfig extraction when run remotely
1 parent 8d45514 commit f330d35

File tree

1 file changed

+0
-18
lines changed
  • deployment/terraform/modules/openstack-kubernetes-infra

1 file changed

+0
-18
lines changed

deployment/terraform/modules/openstack-kubernetes-infra/compute.tf

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,3 @@ data "openstack_networking_secgroup_v2" "er_https_from_lbs" {
138138
name = "er_https_from_lbs"
139139
}
140140

141-
resource "null_resource" "copy_kubeconfig" {
142-
depends_on = [openstack_compute_instance_v2.kubernetes_server]
143-
144-
provisioner "local-exec" {
145-
# Copy the kubeconfig file from the host to a local file using SCP.
146-
# Use ssh-keyscan to prevent interactive prompt on unknown host
147-
# Use sed to replace the localhost address in the KUBECONFIG file with the actual IP adddress of the created VM.
148-
command = <<EOT
149-
mkdir -p ${path.root}/.build/ && \
150-
ssh-keyscan -H ${openstack_compute_instance_v2.kubernetes_server.access_ip_v4} >> ${path.root}/.build/.known_hosts_cogstack && \
151-
scp -o UserKnownHostsFile=${path.root}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \
152-
-i ${local.ssh_keys.private_key_file} \
153-
ubuntu@${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}:/etc/rancher/k3s/k3s.yaml \
154-
${local.kubeconfig_file} && \
155-
sed -i "s/127.0.0.1/${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}/" ${local.kubeconfig_file}
156-
EOT
157-
}
158-
}

0 commit comments

Comments
 (0)