我正在尝试使用 Kubernetes 的 C# 客户端定义部署规范。我的规范字段的值是由其他一些应用程序生成的。因此,部署有时会失败,并且出现Unprocessable entity
(Microsoft.Rest.HttpOperationException) 错误。然而,很难确定哪个字段导致了无法处理的实体错误。
有人可以告诉我如何识别错误的字段吗?
这是跟踪:
Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'UnprocessableEntity'
at k8s.Kubernetes.CreateNamespacedDeploymentWithHttpMessagesAsync(V1Deployment body, String namespaceParameter, String dryRun, String fieldManager, String pretty, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at k8s.KubernetesExtensions.CreateNamespacedDeploymentAsync(IKubernetes operations, V1Deployment body, String namespaceParameter, String dryRun, String fieldManager, String pretty, CancellationToken cancellationToken)
at k8s.KubernetesExtensions.CreateNamespacedDeployment(IKubernetes operations, V1Deployment body, String namespaceParameter, String dryRun, String fieldManager, String pretty)
Run Code Online (Sandbox Code Playgroud)
通过打印 Microsoft.Rest.HttpOperationException 的 Response.Content 字段,我能够获得更详细的错误。
try
{
// Code for deployment
}
catch(Microsoft.Rest.HttpOperationException e)
{
Console.WriteLine(e.Response.Content);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1433 次 |
最近记录: |