2017-11-24 12:19:44 +08:00
|
|
|
using System;
|
|
|
|
|
using k8s;
|
|
|
|
|
|
2017-09-14 10:47:41 -07:00
|
|
|
namespace simple
|
2017-06-12 22:54:30 -07:00
|
|
|
{
|
2017-11-24 12:19:44 +08:00
|
|
|
internal class PodList
|
2017-06-12 22:54:30 -07:00
|
|
|
{
|
2017-11-24 12:19:44 +08:00
|
|
|
private static void Main(string[] args)
|
2017-06-12 22:54:30 -07:00
|
|
|
{
|
2017-11-24 12:19:44 +08:00
|
|
|
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
|
|
|
|
|
IKubernetes client = new Kubernetes(config);
|
2017-07-23 20:45:09 -07:00
|
|
|
Console.WriteLine("Starting Request!");
|
2017-11-24 12:19:44 +08:00
|
|
|
|
|
|
|
|
var list = client.ListNamespacedPod("default");
|
|
|
|
|
foreach (var item in list.Items)
|
|
|
|
|
{
|
2017-06-12 22:54:30 -07:00
|
|
|
Console.WriteLine(item.Metadata.Name);
|
|
|
|
|
}
|
2017-11-24 12:19:44 +08:00
|
|
|
if (list.Items.Count == 0)
|
|
|
|
|
{
|
2017-07-23 20:45:09 -07:00
|
|
|
Console.WriteLine("Empty!");
|
|
|
|
|
}
|
2017-06-12 22:54:30 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|