美文网首页
Kubernetes API Overview

Kubernetes API Overview

作者: JerryAi | 来源:发表于2019-08-04 07:52 被阅读0次

    The REST API is the fundamental fabric of Kubernetes. All operations and communications between components, and external user commands are REST API calls that the API Server handles. Consequently, everything in the Kubernetes platform is treated as an API object and has a corresponding entry in the API.
    REST API是Kubernetes的基本结构。组件和外部用户命令之间的所有操作和通信都是API服务器处理的REST API调用。因此,Kubernetes平台中的所有内容都被视为API对象,并且在API中有相应的条目。

    Most operations can be performed through the kubectl command-line interface or other command-line tools, such as kubeadm, which in turn use the API. However, you can also access the API directly using REST calls.
    大多数操作都可以通过kubectl命令行界面或其他命令行工具(如kubeadm)执行,而这些工具又使用API。不过,您也可以使用REST调用直接访问API。

    Consider using one of the client libraries if you are writing an application using the Kubernetes API.
    如果正在使用Kubernetes API编写应用程序,请考虑使用其中一个客户机库。

    API versioning

    To eliminate fields or restructure resource representations, Kubernetes supports multiple API versions, each at a different API path. For example: /api/v1 or /apis/extensions/v1beta1.
    为了消除字段或重构资源表示,Kubernetes支持多个API版本,每个版本都位于不同的API路径。例如:/api/v1/api/ extensions/v1beta1

    The version is set at the API level rather than at the resource or field level to:
    版本在API级别而不是在资源或字段级别设置:

    • Ensure that the API presents a clear and consistent view of system resources and behavior.确保API对系统资源和行为提供清晰一致的视图。
    • Enable control access to end-of-life and/or experimental APIs.启用对生命终止和/或实验api的控制访问。
      The JSON and Protobuf serialization schemas follow the same guidelines for schema changes. The following descriptions cover both formats.
      对于模式更改,JSON和Protobuf序列化模式遵循相同的指导原则。下面的描述涵盖了这两种格式。

    Note: The API versioning and software versioning are indirectly related. The API and release versioning proposal describes the relationship between API versioning and software versioning. API版本控制和软件版本控制是间接相关的。API和发布版本控制建议描述了API版本控制和软件版本控制之间的关系。
    Different API versions indicate different levels of stability and support. You can find more information about the criteria for each level in the API Changes documentation.
    不同的API版本表示不同级别的稳定性和支持。您可以在API Changes文档中找到关于每个级别的标准的更多信息。

    Here’s a summary of each level:

    Alpha:

    • The version names contain alpha (for example, v1alpha1).
    • The software may contain bugs. Enabling a feature may expose bugs. A feature may be disabled by default.
    • The support for a feature may be dropped at any time without notice.
    • The API may change in incompatible ways in a later software release without notice.
    • The software is recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.

    -版本名称包含alpha(例如,v1alpha1)。
    -软件可能有漏洞。启用某个特性可能会暴露bug。默认情况下可以禁用某个特性。

    -功能的支持可能会在任何时候被取消而不另行通知。

    -在以后的软件版本中,API可能会以不兼容的方式更改,而无需通知。

    -由于bug风险增加和缺乏长期支持,建议只在短期测试集群中使用该软件。

    Beta:

    • The version names contain beta (for example, v2beta3).
    • The software is well tested. Enabling a feature is considered safe. Features are enabled by default.
    • The support for a feature will not be dropped, though the details may change.
    • The schema and/or semantics of objects may change in incompatible ways in a subsequent beta or stable release. When this happens, migration instructions are provided. - This may require deleting, editing, and re-creating API objects. The editing process may require some thought. This may require downtime for applications that rely on the feature.
    • The software is recommended for only non-business-critical uses because of potential for incompatible changes in subsequent releases. If you have multiple clusters which can be upgraded independently, you may be able to relax this restriction.

    -版本名称包含beta(例如,v2beta3)。

    -该软件经过良好测试。启用特性被认为是安全的。默认情况下启用特性。

    -不会取消对功能的支持,但细节可能会有所改变。

    -在随后的beta版或稳定版本中,对象的模式和/或语义可能会发生不兼容的变化。当这种情况发生时,将提供迁移指令。
    -这可能需要删除、编辑和重新创建API对象。编辑过程可能需要一些思考。对于依赖该特性的应用程序,这可能需要停机。

    -由于后续版本中可能出现不兼容的更改,本软件仅推荐非业务关键用途。如果您有多个可以独立升级的集群,则可以放宽这一限制。

    Note: Try the beta features and provide feedback. After the features exit beta, it may not be practical to make more changes.
    注意:尝试beta特性并提供反馈。在特性退出beta版之后,进行更多更改可能不太实际。

    Stable:

    • The version name is vX where X is an integer.
    • The stable versions of features appear in released software for many subsequent versions.

    -版本名是vX,其中X是整数。

    -稳定版本的功能出现在发布的软件为许多后续版本。

    API groups

    API groups make it easier to extend the Kubernetes API. The API group is specified in a REST path and in the apiVersion field of a serialized object.
    API组使扩展Kubernetes API变得更容易。API组在REST路径和序列化对象的apiVersion字段中指定。

    Currently, there are several API groups in use:

    The core (also called legacy) group, which is at REST path /api/v1 and is not specified as part of the apiVersion field, for example, apiVersion: v1.
    The named groups are at REST path /apis/GROUP_NAME/VERSION, and use apiVersion: GROUP_NAME/VERSION (for example, apiVersion: batch/v1). You can find the full list of supported API groups in Kubernetes API reference.

    核心(也称为遗留)组,它位于REST path /api/v1,并且没有指定为apiVersion字段的一部分,例如,apiVersion: v1。
    命名组位于REST path /api /GROUP_NAME/VERSION,并使用apiVersion: GROUP_NAME/VERSION(例如,apiVersion: batch/v1)。您可以在Kubernetes API引用中找到支持的API组的完整列表。

    The two paths that support extending the API with custom resources are:

    CustomResourceDefinition for basic CRUD needs.基本CRUD需求的CustomResourceDefinition。
    aggregator for a full set of Kubernetes API semantics to implement their own apiserver.聚合器为一组完整的Kubernetes API语义实现自己的apiserver。

    Enabling API groups

    Certain resources and API groups are enabled by default. You can enable or disable them by setting --runtime-config on the apiserver. --runtime-config accepts comma separated values. For example: - to disable batch/v1, set --runtime-config=batch/v1=false - to enable batch/v2alpha1, set --runtime-config=batch/v2alpha1 The flag accepts comma separated set of key=value pairs describing runtime configuration of the apiserver.

    默认情况下启用某些资源和API组。您可以通过在apiserver上设置—runtime-config来启用或禁用它们。——runtime-config接受逗号分隔的值。例如:-要禁用batch/v1, set -runtime-config=batch/v1=false -要启用batch/v2alpha1, set -runtime-config=batch/v2alpha1标志接受逗号分隔的一组键值对,它们描述apiserver的运行时配置。

    Note: When you enable or disable groups or resources, you need to restart the apiserver and controller-manager to pick up the --runtime-config changes.
    当您启用或禁用组或资源时,您需要重新启动apiservercontroller-manager来接受—runtime-config更改。

    Enabling resources in the groups

    DaemonSets, Deployments, HorizontalPodAutoscalers, Ingress, Jobs and ReplicaSets are enabled by default. You can enable other extensions resources by setting --runtime-config on apiserver. --runtime-config accepts comma separated values. For example, to disable deployments and jobs, set --runtime-config=extensions/v1beta1/deployments=false,extensions/v1beta1/jobs=false

    默认情况下,守护进程集、部署、HorizontalPodAutoscalers、Ingress、作业和副本集都是启用的。您可以通过在apiserver上设置—runtime-config来启用其他扩展资源。——runtime-config接受逗号分隔的值。例如,要禁用部署和作业,set—runtime-config=extensions/v1beta1/deploy =false,extensions/v1beta1/jobs=false

    相关文章

      网友评论

          本文标题:Kubernetes API Overview

          本文链接:https://www.haomeiwen.com/subject/pddedctx.html