Kubernetes API Overview

    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 Kubernetesplatform is treated as an API object and has a corresponding entry in theAPI.

    Most operations can be performed through the command-line interface or othercommand-line tools, such as kubeadm, which in turn usethe API. However, you can also access the API directly using REST calls.

    Consider using one of the if you are writing an application using the Kubernetes API.

    To eliminate fields or restructure resource representations, Kubernetes supportsmultiple API versions, each at a different API path. For example: or/apis/extensions/v1beta1.

    The version is set at the API level rather than at the resource or field level to:

    • Ensure that the API presents a clear and consistent view of system resources and behavior.
    • Enable control access to end-of-life and/or experimental APIs.

    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.

    Here’s a summary of each level:

    • Alpha:

      • 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.
    • 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 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.
    • Stable:
      • The version name is vX where is an integer.
      • The stable versions of features appear in released software for many subsequent versions.

    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.

    • 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, ). You can find the full list of supported API groups in Kubernetes API reference.

    The two paths that support extending the API with are:

    • CustomResourceDefinitionfor basic CRUD needs.
    • for a full set of Kubernetes API semantics to implement their own apiserver.

    Certain resources and API groups are enabled by default. You can enable or disable them by setting —runtime-configon 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/v2alpha1The flag accepts comma separated set of key=value pairs describing runtime configuration of the apiserver.

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

    Was this page helpful?

    Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it onStack Overflow.Open an issue in the GitHub repo if you want toorsuggest an improvement.