搜索

第 4 章 调试无服务器应用程序

download PDF

您可以使用各种方法对无服务器应用程序进行故障排除。

4.1. 检查终端输出

您可以检查您的部署命令输出,以查看部署是否成功。如果部署过程终止,您应该在输出中看到一条错误消息,该消息描述了部署失败的原因。这种故障很可能是因为清单配置错误或无效的命令。

流程

  • 在您部署和管理应用程序的客户端上打开命令输出。以下示例是在 oc apply 命令失败后可能会看到的错误:

    Error from server (InternalError): error when applying patch:
    {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"serving.knative.dev/v1\",\"kind\":\"Route\",\"metadata\":{\"annotations\":{},\"name\":\"route-example\",\"namespace\":\"default\"},\"spec\":{\"traffic\":[{\"configurationName\":\"configuration-example\",\"percent\":50}]}}\n"}},"spec":{"traffic":[{"configurationName":"configuration-example","percent":50}]}}
    to:
    &{0xc421d98240 0xc421e77490 default route-example STDIN 0xc421db0488 264682 false}
    for: "STDIN": Internal error occurred: admission webhook "webhook.knative.dev" denied the request: mutation failed: The route must have traffic percent sum equal to 100.
    ERROR: Non-zero return code '1' from command: Process exited with status 1

    此输出显示,您必须将路由流量百分比配置为等于 100。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.