zoukankan      html  css  js  c++  java
  • kubernetes-copyFromPod

    import com.google.common.io.ByteStreams;
    import io.kubernetes.client.Copy;
    import io.kubernetes.client.openapi.ApiClient;
    import io.kubernetes.client.openapi.ApiException;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.nio.file.Paths;
    
    public class CopyExample {
    
        public static void main(String[] args)
                throws IOException, ApiException {
            ApiClient k8sApiClient = new ApiClient();
            k8sApiClient.setVerifyingSsl(false);
            k8sApiClient.setApiKeyPrefix("Bearer");
            k8sApiClient.setDebugging(true);
            k8sApiClient.setApiKey("1hKnD2IAp_WWiB-opvibmCwSFQ-jBPw5-L6Br-Oj7BGLRm1UQr7DqxphgVjQRAdMJJWpCL0ArT-U2qjp4SqAT1jbwi3zA-2cj0EsyX6jROUtbOwY_nJCPj3hhOnlj90-fgILRBCZjiNRLS9WYqaJcsWeEn6yEx7Rtm70BaUX3nwJP6ybKkEhprnAiK8CbaViMlRktSo9nBhiyxR0scFBfHNduX2-epIqZyOtQ5sJg");
            k8sApiClient.setBasePath("https://10.222.22.222:8043");
    
            String podName = "base";
            String namespace = "app";
    
            Copy copy = new Copy(k8sApiClient);
            InputStream dataStream = copy.copyFileFromPod(namespace, podName, "/config/application-prod.yaml");
            ByteStreams.copy(dataStream, System.out);
    
            copy.copyDirectoryFromPod(namespace, podName, null, "/config", Paths.get("/tmp/config"));
    
            System.out.println("Done!");
        }
    }
  • 相关阅读:
    编译用到boost相关的东西,问题的解决;以及和googletest库
    看开源代码利器—用Graphviz + CodeViz生成C/C++函数调用图(call graph)
    centos5 升级到centos6
    Go vs Erlang
    Graphviz
    Oracle相关安装经验总结
    学习erlang书籍
    sublime使用总结
    List集合五种遍历方式
    nginx常用命令
  • 原文地址:https://www.cnblogs.com/shix0909/p/13518621.html
Copyright © 2011-2022 走看看