diff --git a/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift b/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift index 720794515..0ee5e0def 100644 --- a/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift +++ b/Sources/ContainerK8s/Support/K8sHelper+Bootstrap.swift @@ -46,6 +46,14 @@ extension K8sHelper { throw ContainerizationError(.internalError, message: "write kubeadm config failed on \(nodeID): \(r.output)") } + r = try await execCapture( + containerId: nodeID, executable: "/bin/sh", + arguments: ["-c", "mkdir -p /kind && ln -sf /etc/kubernetes/kubeadm-config.yaml /kind/kubeadm.conf"], + client: client) + guard r.code == 0 else { + throw ContainerizationError(.internalError, message: "failed to link kind kubeadm config on \(nodeID): \(r.output)") + } + log.info("Running kubeadm init", metadata: ["node": "\(nodeID)"]) r = try await execCapture( containerId: nodeID, executable: kubeadmPath, diff --git a/Tests/IntegrationTests/K8s/TestK8sRunSerial.swift b/Tests/IntegrationTests/K8s/TestK8sRunSerial.swift index 04f17e02d..4996795bc 100644 --- a/Tests/IntegrationTests/K8s/TestK8sRunSerial.swift +++ b/Tests/IntegrationTests/K8s/TestK8sRunSerial.swift @@ -64,6 +64,9 @@ struct TestK8sRunSerial { print("[k8s-run] container status=\(containerStatus)") #expect(containerStatus == "running") + let checkResult = try f.run(["exec", name, "test", "-f", "/kind/kubeadm.conf"]) + #expect(checkResult.status == 0) + let kubeconfig = try loadKubeconfig() let clusters = (kubeconfig["clusters"] as? [[String: Any]]) ?? []