Files
csharp/examples/logs/Logs.cs
Boshi Lian 85755ccb3e 8.0: API Group + v1.24 (#850)
* swagger 1.24

* trim converter

* api group

* before moving method

* grouped api for client

* fix classic build

* fix e2e

* move all code to v8

* fix vis to

* bump ver

* fix authtest filename
2022-05-07 13:05:17 -07:00

32 lines
930 B
C#
Executable File

using System;
using System.Threading.Tasks;
using k8s;
namespace logs
{
internal class Logs
{
private static async Task Main(string[] args)
{
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(config);
Console.WriteLine("Starting Request!");
var list = client.CoreV1.ListNamespacedPod("default");
if (list.Items.Count == 0)
{
Console.WriteLine("No pods!");
return;
}
var pod = list.Items[0];
var response = await client.CoreV1.ReadNamespacedPodLogWithHttpMessagesAsync(
pod.Metadata.Name,
pod.Metadata.NamespaceProperty, follow: true).ConfigureAwait(false);
var stream = response.Body;
stream.CopyTo(Console.OpenStandardOutput());
}
}
}