masroorhasan / Kubernetes.DotNet

Kubernetes C# client for .NET Framework
https://www.nuget.org/packages/Kubernetes.DotNet
MIT License
41 stars 8 forks source link

Kubernetes.DotNet.Client.ApiException: Error calling ListNamespacedPod: The request was aborted: Could not create SSL/TLS secure channel. #22

Open eugen-nw opened 5 years ago

eugen-nw commented 5 years ago

I cannot get this to work using the code below and I'm wondering if anyone could help me. The contents of the filePath file is a copy & paste of the contents of my own ...\.kube\config file.

var k8Client = new KubeConfigClientConfiguration(filePath).CreateClient(AuthType.SSLAuth);
var podsList = k8Client.CoreApi.ListNamespacedPod("default");

The exception call stack is:

Kubernetes.DotNet.Client.ApiException: Error calling ListNamespacedPod: The request was aborted: Could not create SSL/TLS secure channel.
   at Kubernetes.DotNet.Api.Core_v1Api.ListNamespacedPodWithHttpInfo(String _namespace, String pretty, String fieldSelector, Nullable`1 includeUninitialized, String labelSelector, String resourceVersion, Nullable`1 timeoutSeconds, Nullable`1 watch)
   at Kubernetes.DotNet.Api.Core_v1Api.ListNamespacedPod(String _namespace, String pretty, String fieldSelector, Nullable`1 includeUninitialized, String labelSelector, String resourceVersion, Nullable`1 timeoutSeconds, Nullable`1 watch)
   at ScaleoutService.ScaleoutService._GetCurrentInstancesCount() in C:\Users\edaroczy\OneDrive - BoldIQ, Inc\Documents\projects\NetJets\ScaleoutService\ScaleoutService.IScaleoutService.cs:line 229

I'm making this call to an Azure Kubernetes Service instance from a .Net 4.5.2 microservice running within Service Fabric.

The assemblies that I'm using are:

  <package id="BouncyCastle" version="1.8.5" targetFramework="net452" />
  <package id="Kubernetes.DotNet" version="1.0.62" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="10.0.1" targetFramework="net452" />
  <package id="RestSharp" version="105.1.0" targetFramework="net452" />
  <package id="YamlDotNet" version="4.2.2" targetFramework="net452" />
ajamrozek commented 5 years ago

I have the same error. I'm guessing it's related to the inability to parse the insecure-skip-tls-verify flag on the cluster element.