pom.xml
<dependency>
<groupId>com.playtika.testcontainers</groupId>
<artifactId>embedded-k3s</artifactId>
<scope>test</scope>
</dependency>
-
embedded.k3s.enabled
(true|false, default is true)
-
embedded.k3s.reuseContainer
(true|false, default is false)
-
embedded.k3s.dockerImage
(default is 'rancher/k3s:v1.27.1-k3s1')
-
Image versions on dockerhub
-
-
embedded.k3s.port
(int, default is '6443')
-
embedded.k3s.kubeconfig
Kubeconfig for Kubernetes client -
embedded.k3s.networkAlias
-
embedded.k3s.internalPort
-
Bean
K3Container embeddedK3s
You have few options for choosing client:
@Bean(destroyMethod = "close")
public ApiClient kubernetesClient(@Value("${embedded.k3s.kubeconfig}") String kubeconfig) {
return Config.fromConfig(new StringReader(kubeConfigYaml));
}
@Bean(destroyMethod = "close")
public KubernetesClient kubernetesClient(@Value("${embedded.k3s.kubeconfig}") String kubeconfig) {
return new KubernetesClientBuilder().withConfig(Config.from(kubeconfig)).build();
}