io.kubernetes.client.PodLogs Java Examples

The following examples show how to use io.kubernetes.client.PodLogs. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KubeOpt.java    From dew with Apache License 2.0 6 votes vote down vote up
/**
 * Instantiates a new Kube opt.
 *
 * @param log              the log
 * @param base64KubeConfig the base64 kube config
 */
protected KubeOpt(Logger log, String base64KubeConfig) {
    this.log = log;
    YamlHelper.init(log);
    try {
        client = Config.fromConfig(
                KubeConfig.loadKubeConfig(
                        new StringReader(
                                $.security.decodeBase64ToString(base64KubeConfig, "UTF-8")
                        )
                )
        );
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    client.setReadTimeout(0);
    Configuration.setDefaultApiClient(client);
    coreApi = new CoreV1Api(client);
    appsApi = new AppsV1Api(client);
    extensionsApi = new ExtensionsV1beta1Api(client);
    rbacAuthorizationApi = new RbacAuthorizationV1Api(client);
    autoscalingApi = new AutoscalingV2beta2Api(client);
    podLogs = new PodLogs(client);
}
 
Example #2
Source File: LogsExample.java    From java with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException, ApiException, InterruptedException {
  ApiClient client = Config.defaultClient();
  Configuration.setDefaultApiClient(client);
  CoreV1Api coreApi = new CoreV1Api(client);

  PodLogs logs = new PodLogs();
  V1Pod pod =
      coreApi
          .listNamespacedPod("default", "false", null, null, null, null, null, null, null, null)
          .getItems()
          .get(0);

  InputStream is = logs.streamNamespacedPodLog(pod);
  ByteStreams.copy(is, System.out);
}
 
Example #3
Source File: K8sClient.java    From pravega with Apache License 2.0 4 votes vote down vote up
K8sClient() {
    this.client = initializeApiClient();
    this.logUtility = new PodLogs();
}