File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . IO ;
3
+ using System . Threading . Tasks ;
4
+ using k8s ;
5
+
6
+ namespace logs
7
+ {
8
+ internal class Logs
9
+ {
10
+ private static async Task Main ( string [ ] args )
11
+ {
12
+ var config = KubernetesClientConfiguration . BuildConfigFromConfigFile ( ) ;
13
+ IKubernetes client = new Kubernetes ( config ) ;
14
+ Console . WriteLine ( "Starting Request!" ) ;
15
+
16
+ var list = client . ListNamespacedPod ( "default" ) ;
17
+ if ( list . Items . Count == 0 ) {
18
+ Console . WriteLine ( "No pods!" ) ;
19
+ return ;
20
+ }
21
+ var pod = list . Items [ 0 ] ;
22
+
23
+ var response = await client . ReadNamespacedPodLogWithHttpMessagesAsync ( pod . Metadata . Name , pod . Metadata . NamespaceProperty , follow : true ) ;
24
+ var stream = response . Body ;
25
+ stream . CopyTo ( Console . OpenStandardOutput ( ) ) ;
26
+ }
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+
3
+ <ItemGroup >
4
+ <ProjectReference Include =" ..\..\src\KubernetesClient.csproj" />
5
+ </ItemGroup >
6
+
7
+ <PropertyGroup >
8
+ <OutputType >Exe</OutputType >
9
+ <TargetFramework >netcoreapp2.0</TargetFramework >
10
+ <LangVersion >7.1</LangVersion >
11
+ </PropertyGroup >
12
+
13
+ </Project >
You can’t perform that action at this time.
0 commit comments