Files
csharp/examples/logs/Logs.cs
Manuel Menegazzo f615b5b459 Fix some compilation warnings (#1010)
* Fixe some summary warning

* Fixed more warning

* Uniformed example projects code

* Uniformed test projects code

* Fix OperatingSystems enum and GenericType summaries
2022-09-15 16:21:21 -07:00

32 lines
970 B
C#
Executable File

using k8s;
using System;
using System.Threading.Tasks;
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, container: pod.Spec.Containers[0].Name, follow: true).ConfigureAwait(false);
var stream = response.Body;
stream.CopyTo(Console.OpenStandardOutput());
}
}
}