In Kubernetes Java client API, it seems that there is no support to copy files to Pod. There is one function in Copy.java called "copyFileToPod(String namespace, String pod, String container, Path srcPath, Path destPath)",I am using java client version:7.0.0, but it does not work. My srcPath was "Paths.get("hello.txt");" and destPath was "Paths.get("/usr/share/logstash/logstashvolume/hello");".The source file was not encoded. How to copy files to Pod using kubernetes java client library.
I did this by using fabric8.io Kubernetes java client
try (final KubernetesClient client = new DefaultKubernetesClient(config);
ExecWatch watch = client.pods().inNamespace(namespace).withName(podName)
.readingInput(System.in)
.writingOutput(System.out)
.writingError(System.err)
.withTTY()
.usingListener(new SimpleListener())
.exec()){
Thread.sleep(10 * 1000);
}