@Override
    protected void containerIsStarted(InspectContainerResponse containerInfo) {
        String rawKubeConfig = copyFileFromContainer(
            "/etc/rancher/k3s/k3s.yaml",
            is -> IOUtils.toString(is, StandardCharsets.UTF_8)
        );
        String serverUrl = "https://" + this.getHost() + ":" + this.getMappedPort(KUBE_SECURE_PORT);
        kubeConfigYaml = kubeConfigWithServerUrl(rawKubeConfig, serverUrl);
    }
Testcontainers implementation for K3S
<p>
Supported image: {@code rancher/k3s}
modules/k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java