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!");
        }
    }
  • 相关阅读:
    SE知识整理——泛型
    IDEA 运行 SpringMVC 项目分发控制器出现404解决方案。
    快速幂/欧拉降幂
    Leetcode(双指针专题)
    剑指offer
    ns3参考
    网络知识1:最后一公里/WiMax / 4G
    备份2
    shell入门
    ns3_gdb:协议里的函数是怎么被调用的
  • 原文地址:https://www.cnblogs.com/shix0909/p/13518621.html
Copyright © 2011-2022 走看看