代码之家  ›  专栏  ›  技术社区  ›  LM10

在C#-client中识别kubernetes部署规范中的错误字段

  •  1
  • LM10  · 技术社区  · 6 年前

    我正试图使用Kubernetes的C#-客户机定义一个部署规范。我的规范的字段值是由其他应用程序生成的。因此,部署有时会失败,我得到一个 Unprocessable entity

    有人能告诉我如何识别错误的字段吗?

    这是线索:

    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)
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Rico    6 年前

    所有的Kubernetes请求都通过 kube-apiserver here .

    kubectl apply -f deployment.yaml 看看你能不能重现这个错误。

        2
  •  0
  •   LM10    6 年前

    try
    {
        // Code for deployment
    }
    catch(Microsoft.Rest.HttpOperationException e)
    {
        Console.WriteLine(e.Response.Content);
    }
    
    推荐文章