程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Kubernetes 客户端 c# 无法建立 SSL 连接大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Kubernetes 客户端 c# 无法建立 SSL 连接?

开发过程中遇到Kubernetes 客户端 c# 无法建立 SSL 连接的问题如何解决?下面主要结合日常开发的经验,给出你关于Kubernetes 客户端 c# 无法建立 SSL 连接的解决方法建议,希望对你解决Kubernetes 客户端 c# 无法建立 SSL 连接有所启发或帮助;

我正在尝试按如下方式连接 kubernetes 集群,并从给定的 aks 集群中获取节点、pod 和服务的列表..

@H_673_5@        var clIEntID = ".........";
        var clIEntSecret = ".........";
        var tenantID = "xxxxxxxxxxxx.onmicrosoft.com";
        var subscriptionID = "...........";
        var clustername = "aks-k8s";
        var resourceGroupname = "test";

        var credentials = SdkContext.AzureCredentialsFactory.FromservicePrincipal(clIEntID,clIEntSecret,tenantID,AzureEnvironment.AzureGlobalCloud);

        var azure = Azure.Configure()
                         .Authenticate(credentials)
                         .WithSubscription(subscriptionID);

        IKubernetesCluster kubernetesCluster = azure.Kubernetesclusters
            .GetByresourceGroup(resourceGroupname,clusterName);

        if (kubernetesCluster != null)
        {
            var buffer = kubernetesCluster.UserKubeConfigContent;
            var configStream = new MemoryStream(buffer);

            var config = KubernetesClIEntConfiguration.buildConfigFromConfigfile(configStream,null,null);
            IKubernetes clIEnt = new Kubernetes(config);

            var nodes = await clIEnt.ListNodeAsync();

            foreach (var node in nodes.Items)
            {
                //update my database with this List.....
            }
        }
        else
        {
            Console.Writeline(clustername + " cluster does not exits");
        }

由于互联网上没有太多支持,我无法找出问题所在。我可以在本地运行它,但是当我尝试将其设为 azure 函数或 azure web 应用程序时,出现以下错误

@H_673_5@        The SSL connection Could not be established,see inner exception.

        at System.Net.sspIWrapper.AcquireCredentialsHandle(sspIInterface secModule,String package,CredentialUsE intent,SCHAnnEL_CRED scC)   at System.Net.Security.SslStreamPal.AcquireCredentialsHandle(CredentialUse credUsage,SCHAnnEL_CRED secureCredential)   at System.Net.Security.SslStreamPal.AcquireCredentialsHandle(X509Certificate certificate,SslProtocols protocols,EncryptionPolicy policy,Boolean isServer)   at System.Net.Security.SecureChAnnel.AcquireClIEntCredentials(Byte[]& thumbPrint)   at System.Net.Security.SecureChAnnel.Generatetoken(Byte[] input,Int32 offset,Int32 count,Byte[]& output)   at System.Net.Security.SecureChAnnel.Nextmessage(Byte[] incoming,Int32 count)   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming,AsyncProtocolrequest asyncrequest)   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer,AsyncProtocolrequest asyncrequest)   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer,Int32 readBytes,AsyncProtocolrequest asyncrequest)   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer,AsyncProtocolrequest asyncrequest)   at System.Net.Security.SslState.checkCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolrequest asyncrequest)   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming,AsyncProtocolrequest asyncrequest)   at System.Net.Security.SslState.PartialFrameCallBACk(AsyncProtocolrequest asyncrequest)--- End of stack trace from prevIoUs LOCATIOn where exception was thrown ---   at System.Net.Security.SslState.ThrowIfExceptional()   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)   at System.Net.Security.SslStream.EndAuthenticateAsClIEnt(IAsyncResult asyncResult)   at System.Net.Security.SslStream.<>c.<AuthenticateAsClIEntAsync>b__47_1(IAsyncResult iar)   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar,Func`2 endFunction,Action`1 endAction,Task`1 promise,Boolean requiresSynchronization)--- End of stack trace from prevIoUs LOCATIOn where exception was thrown ---   at System.Net.http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream,SslClIEntAuthenticationoptions sslOptions,CancellationToken cancellationToken)

我在这里遗漏了什么.. 帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的Kubernetes 客户端 c# 无法建立 SSL 连接全部内容,希望文章能够帮你解决Kubernetes 客户端 c# 无法建立 SSL 连接所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。