public static void main(String[] args) throws InterruptedException { String master = "https://localhost:8443/"; String podName = null; if (args.length == 2) { master = args[0]; podName = args[1]; } if (args.length == 1) { podName = args[0]; } Config config = new ConfigBuilder().withMasterUrl(master).build(); try (final KubernetesClient client = new DefaultKubernetesClient(config); ExecWatch watch = client .pods() .withName(podName) .readingInput(System.in) .writingOutput(System.out) .writingError(System.err) .withTTY() .usingListener(new SimpleListener()) .exec()) { Thread.sleep(10 * 1000); } }
@Override public Object lookup(ArquillianResource resource, Annotation... qualifiers) { KubernetesClient client = this.clientInstance.get(); Session session = sessionInstance.get(); String name = getServiceName(qualifiers); return client.pods().inNamespace(session.getNamespace()).withName(name).get(); }