main
黄海 10 months ago
parent 945ad9b5e4
commit 6828a848ee

@ -17,14 +17,10 @@ import java.util.regex.Pattern;
public class K8sClientTest {
public static void getAllPodList() throws IOException, ApiException {
//Master /root/.kube/config文件拷贝过来
String kubeConfigPath = PathKit.getRootClassPath() + "\\.kube\\config";
if (!new File(kubeConfigPath).exists()) {
System.out.println("kubeConfig不存在跳过");
return;
}
//Master /root/.kube/config文件拷贝过来
public static String kubeConfigPath = PathKit.getRootClassPath() + "\\.kube\\config";
public static void getAllPodList() throws IOException, ApiException {
ApiClient apiClient = ClientBuilder.kubeconfig(KubeConfig.loadKubeConfig(new FileReader(kubeConfigPath))).build();
// new a CoreV1Api
CoreV1Api api = new CoreV1Api(apiClient);

Loading…
Cancel
Save