---
url: 'https://www.redhat.com/topics/containers/what-is-the-kubernetes-api'
title: 'Kubernetes 解读之：一文带你看懂 K8s API 接口是什么？'
date: '2024-11-20T22:53:14+00:00'
updated: '2025-08-29T16:29:32+00:00'
type: website
summary: 'Kubernetes API （应用编程接口）是 K8s 控制平面的前端，也是用户与其 K8s 集群进行交互的途径。本质上，API 是用于管理、创建和配置 Kubernetes 集群的接口。'
tags:
  - Article
  - Cloud
  - Containers
  - Integration
  - 容器
image: 'https://www.redhat.com/profiles/rh/themes/redhatdotcom/img/logo-rh-og-image.png'
published: true
---
  

  

1. [主题](/zh-cn/topics "主题")
2. [容器](/zh-cn/topics/containers "容器")
3. [什么是 Kubernetes API？](# "什么是 Kubernetes API？")

 

 

# 什么是 Kubernetes API？





 Published  2020 年 6 月 19 日•*3* 分钟阅读

已复制复制失败复制 URL





 

 

 

   

## 快速跳转

Kubernetes API 简介什么是 Kubernetes？什么是集群？API 和 Operator为什么选择红帽？

 

 

## Kubernetes API 简介



Kubernetes API 是 Kubernetes 控制平面的前端，也是用户与其 Kubernetes 集群进行交互的途径。[API（应用编程接口）](/zh-cn/topics/api/what-are-application-programming-interfaces)服务器用于确定请求是否有效，然后对其进行处理。

本质上，API 是用于管理、创建和配置 [Kubernetes 集群](/zh-cn/topics/containers/what-is-a-kubernetes-cluster)的接口。用户、外部组件和集群中的各个部分就是通过它来相互通信的。

Kubernetes 控制平面的中心是 API 服务器和 HTTP API，它们可用于查询和操控 Kubernetes 对象的状态。

[企业级 Kubernetes 免费试用](/zh-cn/technologies/cloud-computing/openshift)





 

## 什么是 Kubernetes？



要想充分了解 Kubernetes API，我们需要站在更高的层面来了解一下什么是 [Kubernetes](/zh-cn/topics/containers/what-is-kubernetes)。

Kubernetes 是一个用于编排[容器](/zh-cn/topics/containers/whats-a-linux-container)的开源平台。容器技术允许您打包应用程序并将其与整个运行时环境隔离，以便轻松地在不同阶段（开发、生产等）和不同环境（内部、公共云、私有云、混合云或多云）中移动容器化应用，同时仍保留全部功能。

因此，作为[容器编排](/zh-cn/topics/containers/what-is-container-orchestration)平台，Kubernetes 可以自动执行在管理、部署和扩展容器化应用中的许多手动流程。  
  
通过将运行容器化应用的计算机（物理或虚拟服务器，称为"节点"）分组，您可以创建一个集群，然后使用 Kubernetes 对其进行管理和编排。

一组在单个计算机或节点上运行并共享资源的容器被称为"容器集"，但容器集中也可以只有一个容器——在这种情况下，我们可以只称其为"容器"，从概念上来讲并没有错误。







 

## 红帽资源











[扩展阅读](/zh-cn/resources "扩展阅读")







 

   

## 什么是集群？



[Kubernetes 集群](/zh-cn/topics/containers/what-is-a-kubernetes-cluster)包含两个部分：控制平面和应用平面。API 会在控制平面决定用户如何与集群交互，会使用 kubectl（一个命令行工具）来告诉命令行要做些什么。通过 API，最终用户、集群本身以及外部组件得以进行相互通信。

每个集群都有预期状态，定义了应运行的应用或工作负载，以及其他的配置详细信息（例如所使用的镜像和所需的资源）。集群的预期状态是使用 API 设置的：或通过命令行 kubectl 工具，或通过 API 与集群进行交互以设置或修改预期状态。

Kubernetes 会自动[管理您的集群](/zh-cn/topics/containers/what-is-kubernetes-cluster-management)，以匹配预期状态。Kubernetes 采用声明式部署模式，它会始终尝试根据为其工作负载设定的参数进行自我管理和自我修复。







 

## API 与 Kubernetes Operator



[Kubernetes Operator](/zh-cn/topics/containers/what-is-a-kubernetes-operator) 是一种利用 API 借助 kubectl 工具来封装、部署和管理应用的方法。

在 Kubernetes 中，Operator 是一种特定于应用的控制器，它可以扩展 Kubernetes API 的功能，从而代表用户创建、配置和管理复杂应用的实例。通过包含特定于域或应用的信息，Operator 可以让 Kubernetes 在所管理软件的整个生命周期内实现自动化。







 

## 红帽企业就绪型 Kubernetes 的优势



作为开源容器技术的领导者以及众多容器基础架构管理工具和产品的创造者，红帽致力于带领您拥抱 Kubernetes 和容器技术。

选择红帽® OpenShift®，您就获得了一个企业级开源容器平台，其中包含管理混合云和多云部署所需的一切资源。我们可以协助您将业务逐渐过渡到云端，同时仍能最大程度地利用好当前的基础架构。

作为单个集成式平台的一部分，开发人员不仅可以选择语言、中间件、框架和数据库，还可以部署自动化以提高工作效率和生产力。

[试用红帽 OpenShift](/zh-cn/technologies/cloud-computing/openshift)







 

 

   











### 红帽官方博客



获取有关我们的客户、合作伙伴和社区生态系统的最新信息。











[扩展阅读](/zh-cn/blog "红帽官方博客")







   

 

 

   

### 所有红帽产品试用

我们的免费试用服务可让您亲身体验红帽的产品功能，为获得认证做好准备，或评估某个产品是否适合您的企业组织。



 

    

[扩展阅读](/zh-cn/products/trials "所有红帽产品试用") 

 

 

 

 



 

   

## 扩展阅读



  











### Kubernetes 架构简介



 简要介绍 Kubernetes 的各个组件及其交互方式。 









[阅读文章](/zh-cn/topics/containers/kubernetes-architecture "article | introduction to kubernetes architecture &#91;DO NOT OVERWRITE ZH META&#93;")





 

  











### 什么是容器编排？



 容器编排可实现容器部署、管理、扩展和网络连接自动化。 









[阅读文章](/zh-cn/topics/containers/what-is-container-orchestration "article | what is container orchestration?")





 

  











### 什么是 Kubernetes Operator？



 Kubernetes Operator 是一种通过扩展 Kubernetes API 的功能来打包、部署和管理应用的方法。 









[阅读文章](/zh-cn/topics/containers/what-is-a-kubernetes-operator "article | what is a kubernetes operator?&#91;DO NOT OVERWRITE ZH META&#93;")





 

 

 

   

### 容器 相关资源



 

### 相关内容

 

 

- 博客文章
    
     [Managing virtual machines on Red Hat OpenShift with Service Mesh](/zh-cn/blog/managing-virtual-machines-red-hat-openshift-service-mesh)
- 博客文章
    
     [Can't patch fast enough? Zero trust as a last line of defense](/zh-cn/blog/cant-patch-fast-enough-zero-trust-last-line-defense)
- 博客文章
    
     [4 reasons to start using image mode for Red Hat Enterprise Linux right now](/zh-cn/blog/4-reasons-start-using-image-mode-red-hat-enterprise-linux-right-now)
- 博客文章
    
     [Hardened, ready, and no cost: Container security evolved](/zh-cn/blog/red-hat-hardened-images)
 
 

 

 

 

 

### 相关文章

 

 

- [Introduction to Kubernetes architecture](/zh-cn/topics/containers/kubernetes-architecture)
- [What is container-native virtualization?](/zh-cn/topics/containers/what-is-container-native-virtualization)
- [What is container orchestration?](/zh-cn/topics/containers/what-is-container-orchestration)
- [What is a Kubernetes operator?](/zh-cn/topics/containers/what-is-a-kubernetes-operator)
- [What is Kubernetes?](/zh-cn/topics/containers/what-is-kubernetes)
- [What is an independent software vendor (ISV)?](/zh-cn/topics/digital-transformation/isv-partners)
- [Red Hat OpenShift for developers](/zh-cn/technologies/cloud-computing/openshift/developers)
- [What is a golden image?](/zh-cn/topics/linux/what-is-a-golden-image)
- [What is Podman Desktop?](/zh-cn/topics/containers/what-is-podman-desktop)
- [What is KubeVirt?](/zh-cn/topics/virtualization/what-is-kubevirt)
- [What is application integration?](/zh-cn/topics/cloud-native-apps/application-integration)
- [What is the Kubernetes Java client?](/zh-cn/topics/cloud-computing/what-is-kubernetes-java-client)
- [Kubernetes on AWS: Self-Managed vs. Managed Applications Platforms](/zh-cn/topics/containers/kubernetes-on-aws)
- [What is an API?](/zh-cn/topics/api/what-are-application-programming-interfaces)
- [What are hosted control planes?](/zh-cn/topics/containers/what-are-hosted-control-planes)
- [What is GraphQL?](/zh-cn/topics/api/what-is-graphql)
- [Edge computing with Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/edge-computing)
- [What is kubernetes security?](/zh-cn/topics/containers/kubernetes-security)
- [What was CoreOS and CoreOS container Linux](/zh-cn/technologies/cloud-computing/openshift/what-was-coreos)
- [How Kubernetes can help AI/ML](/zh-cn/topics/cloud-computing/how-kubernetes-can-help-ai)
- [Stateful vs stateless applications](/zh-cn/topics/cloud-native-apps/stateful-vs-stateless)
- [What is containerization?](/zh-cn/topics/cloud-native-apps/what-is-containerization)
- [What is a REST API?](/zh-cn/topics/api/what-is-a-rest-api)
- [What is Kubeflow?](/zh-cn/topics/cloud-computing/what-is-kubeflow)
- [What are microservices?](/zh-cn/topics/microservices/what-are-microservices)
- [What is container security?](/zh-cn/topics/security/container-security)
- [OpenShift vs. OpenStack: What are the differences?](/zh-cn/technologies/cloud-computing/openshift/openshift-vs-openstack)
- [What is Buildah?](/zh-cn/topics/containers/what-is-buildah)
- [What is Knative?](/zh-cn/topics/microservices/what-is-knative)
- [Kubernetes vs OpenStack](/zh-cn/topics/containers/kubernetes-vsopenstack)
- [What is YAML?](/zh-cn/topics/automation/what-is-yaml)
- [What is etcd?](/zh-cn/topics/containers/what-is-etcd)
- [What is an image builder?](/zh-cn/topics/linux/what-is-an-image-builder)
- [What is middleware?](/zh-cn/topics/middleware/what-is-middleware)
- [Red Hat OpenShift vs. OKD](/zh-cn/topics/containers/red-hat-openshift-okd)
- [Red Hat OpenShift vs. Kubernetes: What's the difference?](/zh-cn/technologies/cloud-computing/openshift/red-hat-openshift-kubernetes)
- [What is high availability and disaster recovery for containers?](/zh-cn/topics/containers/high-availability-containers)
- [Why run Apache Kafka on Kubernetes?](/zh-cn/topics/integration/why-run-apache-kafka-on-kubernetes)
- [Spring on Kubernetes with Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/spring)
- [What is Apache Kafka?](/zh-cn/topics/integration/what-is-apache-kafka)
- [What are Red Hat OpenShift cloud services?](/zh-cn/technologies/cloud-computing/openshift/what-are-red-hat-openshift-cloud-services)
- [Why choose Red Hat for middleware?](/zh-cn/topics/middleware/why-choose-red-hat-middleware)
- [What is a container registry?](/zh-cn/topics/cloud-native-apps/what-is-a-container-registry)
- [What is Podman?](/zh-cn/topics/containers/what-is-podman)
- [What is Skopeo?](/zh-cn/topics/containers/what-is-skopeo)
- [What are Red Hat OpenShift Operators?](/zh-cn/technologies/cloud-computing/openshift/what-are-openshift-operators)
- [Using Helm with Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/helm)
- [Kubernetes security best practices](/zh-cn/topics/containers/kubernetes-security-best-practices)
- [Orchestrating Windows containers on Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/windows-containers-on-red-hat-openshift)
- [What are sandboxed containers](/zh-cn/topics/containers/sandboxed-containers)
- [What is a Linux container?](/zh-cn/topics/containers/whats-a-linux-container)
- [Red Hat OpenShift application services](/zh-cn/technologies/cloud-computing/openshift/application-services)
- [Why use Red Hat Ansible Automation Platform with Red Hat OpenShift?](/zh-cn/technologies/cloud-computing/openshift/ansible-on-openshift)
- [High performance computing with Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/high-performance-computing)
- [Advantages of Kubernetes-native security](/zh-cn/topics/containers/advantages-of-kubernetes-native-security)
- [What is a Kafka service?](/zh-cn/topics/integration/what-is-a-kafka-service)
- [What is KubeLinter?](/zh-cn/topics/containers/what-is-kubelinter)
- [What is streaming data?](/zh-cn/topics/integration/what-is-streaming-data)
- [Container and Kubernetes compliance considerations](/zh-cn/topics/containers/compliance)
- [Intro to Kubernetes security](/zh-cn/topics/containers/intro-kubernetes-security)
- [Do banking APIs benefit from cloud technology?](/zh-cn/topics/api/banking-api)
- [What is a service registry?](/zh-cn/topics/integration/what-is-a-service-registry)
- [What is an event mesh?](/zh-cn/topics/integration/what-is-an-event-mesh)
- [How microservices support IT integration in healthcare](/zh-cn/topics/microservices/microservices-in-healthcare)
- [Kubernetes cluster management](/zh-cn/technologies/cloud-computing/openshift/kubernetes-cluster-management)
- [Red Hat OpenShift on IBM IT infrastructure](/zh-cn/technologies/cloud-computing/openshift/what-is-red-hat-openshift-on-IBM-IT-infrastructure)
- [Red Hat OpenShift for business leaders](/zh-cn/technologies/cloud-computing/openshift/business-leaders)
- [How to deploy Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/deploy-red-hat-openshift)
- [Cost management for Kubernetes on Red Hat OpenShift](/zh-cn/technologies/cloud-computing/openshift/cost-management)
- [Red Hat OpenShift on VMware](/zh-cn/technologies/cloud-computing/openshift/vmware)
- [What makes Red Hat OpenShift the right choice for SAP?](/zh-cn/technologies/cloud-computing/openshift/sap)
- [Why choose Red Hat for Kubernetes?](/zh-cn/topics/containers/why-choose-red-hat-kubernetes)
- [Kubernetes-native Java development with Quarkus](/zh-cn/technologies/cloud-computing/openshift/quarkus)
- [What is enterprise Kubernetes?](/zh-cn/topics/containers/what-is-enterprise-kubernetes)
- [What makes Red Hat OpenShift the right choice for IT operations?](/zh-cn/technologies/cloud-computing/openshift/it-operations)
- [What is Kubernetes role-based access control (RBAC)](/zh-cn/topics/containers/shenmeshi-kubernetes-jiyujiaosedefangwenquanxiankongzhirbac)
- [VNF and CNF, what’s the difference?](/zh-cn/topics/cloud-native-apps/vnf-and-cnf-whats-the-difference)
- [What is change data capture?](/zh-cn/topics/integration/what-is-change-data-capture)
- [Why Red Hat for APIs?](/zh-cn/topics/api/why-choose-red-hat-apis)
- [Learning Kubernetes basics](/zh-cn/topics/containers/learning-kubernetes-tutorial)
- [What is service-oriented architecture?](/zh-cn/topics/cloud-native-apps/what-is-service-oriented-architecture)
- [What is Kubernetes cluster management?](/zh-cn/topics/containers/what-is-kubernetes-cluster-management)
- [What is a Kubernetes deployment?](/zh-cn/topics/containers/what-is-kubernetes-deployment)
- [Why choose the Red Hat build of Quarkus?](/zh-cn/topics/cloud-native-apps/why-choose-red-hat-quarkus)
- [What is CaaS?](/zh-cn/topics/cloud-computing/what-is-caas)
- [Introduction to Kubernetes patterns](/zh-cn/topics/cloud-native-apps/introduction-to-kubernetes-patterns)
- [Containers vs. VMs: Why not both?](/zh-cn/topics/containers/containers-vs-vms)
- [What is a Kubernetes cluster?](/zh-cn/topics/containers/what-is-a-kubernetes-cluster)
- [What is Quarkus?](/zh-cn/topics/cloud-native-apps/what-is-quarkus)
- [What is Jaeger?](/zh-cn/topics/microservices/what-is-jaeger)
- [What is event-driven architecture?](/zh-cn/topics/integration/what-is-event-driven-architecture)
- [What is API monetization?](/zh-cn/topics/api/what-is-api-monetization)
- [REST vs. SOAP](/zh-cn/topics/integration/whats-the-difference-between-soap-rest)
- [Why choose Red Hat for integration?](/zh-cn/topics/integration/why-choose-red-hat-integration)
- [What is API design?](/zh-cn/topics/api/what-is-api-design)
- [What is Clair?](/zh-cn/topics/containers/what-is-clair)
- [What is API management?](/zh-cn/topics/api/what-is-api-management)
- [What does an API gateway do?](/zh-cn/topics/api/what-does-an-api-gateway-do)
- [What is API security?](/zh-cn/topics/security/api-security)
- [What is a service mesh?](/zh-cn/topics/microservices/what-is-a-service-mesh)
- [Why choose Red Hat for microservices?](/zh-cn/topics/microservices/why-choose-red-hat-microservices)
- [What is network-attached storage?](/zh-cn/topics/data-storage/network-attached-storage)
- [What is software-defined storage?](/zh-cn/topics/data-storage/software-defined-storage)
- [Why choose Red Hat for containers?](/zh-cn/topics/containers/why-choose-red-hat-containers)
- [What is Docker?](/zh-cn/topics/containers/what-is-docker)
- [What is a Kubernetes pod?](/zh-cn/topics/containers/what-is-kubernetes-pod)
- [What is integration?](/zh-cn/topics/integration/what-is-integration)
 
 

 

   

[有关此主题的更多信息](/zh-cn/topics/containers "有关此主题的更多信息")