kubernetes api http请求状态码
摘录自:https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#http-status-codes
The following HTTP status codes may be returned by the API.
Success codes
200 StatusOK
- Indicates that the request completed successfully.
201 StatusCreated
- Indicates that the request to create kind completed successfully.
204 StatusNoContent
- Indicates that the request completed successfully, and the response contains no body.
- Returned in response to HTTP OPTIONS requests.
Error codes
-
307 StatusTemporaryRedirect
- Indicates that the address for the requested resource has changed.
- Suggested client recovery behavior:
- Follow the redirect.
-
400 StatusBadRequest
- Indicates the requested is invalid.
- Suggested client recovery behavior:
- Do not retry. Fix the request.
-
401 StatusUnauthorized
- Indicates that the server can be reached and understood the request, but refuses to take any further action, because the client must provide authorization. If the client has provided authorization, the server is indicating the provided authorization is unsuitable or invalid.
- Suggested client recovery behavior:
- If the user has not supplied authorization information, prompt them for the appropriate credentials. If the user has supplied authorization information, inform them their credentials were rejected and optionally prompt them again.
-
403 StatusForbidden
- Indicates that the server can be reached and understood the request, but refuses to take any further action, because it is configured to deny access for some reason to the requested resource by the client.
- Suggested client recovery behavior:
- Do not retry. Fix the request.
-
404 StatusNotFound
- Indicates that the requested resource does not exist.
- Suggested client recovery behavior:
- Do not retry. Fix the request.
-
405 StatusMethodNotAllowed
- Indicates that the action the client attempted to perform on the resource was not supported by the code.
- Suggested client recovery behavior:
- Do not retry. Fix the request.
-
409 StatusConflict
- Indicates that either the resource the client attempted to create already exists or the requested update operation cannot be completed due to a conflict.
- Suggested client recovery behavior:
- If creating a new resource:
- Either change the identifier and try again, or GET and compare the fields in the pre-existing object and issue a PUT/update to modify the existing object.
- If updating an existing resource:
- See
Conflict
from thestatus
response section below on how to retrieve more information about the nature of the conflict. - GET and compare the fields in the pre-existing object, merge changes (if still valid according to preconditions), and retry with the updated request (including
ResourceVersion
).
- See
- If creating a new resource:
-
410 StatusGone
- Indicates that the item is no longer available at the server and no forwarding address is known.
- Suggested client recovery behavior:
- Do not retry. Fix the request.
-
422 StatusUnprocessableEntity
- Indicates that the requested create or update operation cannot be completed due to invalid data provided as part of the request.
- Suggested client recovery behavior:
- Do not retry. Fix the request.
-
429 StatusTooManyRequests
- Indicates that the either the client rate limit has been exceeded or the server has received more requests then it can process.
- Suggested client recovery behavior:
- Read the
Retry-After
HTTP header from the response, and wait at least that long before retrying.
- Read the
-
500 StatusInternalServerError
- Indicates that the server can be reached and understood the request, but either an unexpected internal error occurred and the outcome of the call is unknown, or the server cannot complete the action in a reasonable time (this may be due to temporary server load or a transient communication issue with another server).
- Suggested client recovery behavior:
- Retry with exponential backoff.
-
503 StatusServiceUnavailable
- Indicates that required service is unavailable.
- Suggested client recovery behavior:
- Retry with exponential backoff.
-
504 StatusServerTimeout
- Indicates that the request could not be completed within the given time. Clients can get this response ONLY when they specified a timeout param in the request.
- Suggested client recovery behavior:
- Increase the value of the timeout param and retry with exponential backoff.
如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。
分类:
Kubernetes
标签:
K8S
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程