【问题标题】:Scaling and listing deployments via Kubernetes HTTP API?通过 Kubernetes HTTP API 扩展和列出部署?
【发布时间】:2020-06-02 09:12:30
【问题描述】:

我正在尝试通过 HTTP 扩大/缩小一些部署,并列出我的集群上的部署。我可以列出 pod,但无法弄清楚部署部分。

http://localhost:8080/api/v1/namespaces/default/deployments

{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Failure",
    "message": "the server could not find the requested resource",
    "reason": "NotFound",
    "details": {},
    "code": 404
}

【问题讨论】:

    标签: kubernetes


    【解决方案1】:

    部署位于 apps/v1 命名空间中,您需要在 URL 中包含 appsAPI documentation for the "list deployments" endpoint 给出的 URL 为

    GET /apis/apps/v1/namespaces/{namespace}/deployments
    

    您可以使用正常的读取-修改-写入序列来更改部署规范中的 replicas: 字段以对其进行扩展。

    还有a dedicated endpoint to scale deployments,尽管它的文档记录略显不足。 Manage replicas count for deployment using Kubernetes API 建议读取和修补规模资源,或者有一个带有最小 JSON 负载的示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多