> For the complete documentation index, see [llms.txt](https://listen-lavender.gitbook.io/prefect-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://listen-lavender.gitbook.io/prefect-docs/tasklibrary/kubernetes.md).

# Kubernetes

与各种Kubernetes API对象进行交互的task。

注意根据选择的身份验证方式，此集合中的task可能需要一个名为“KUBERNETES\_API\_KEY”的Prefect密钥，用于存储Kubernetes API密钥。 此密钥必须是一个字符串，且采用BearerToken格式。

## 部署（Deployment）

### CreateNamespacedDeployment

在Kubernetes上创建指定命名空间的部署的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespaceddeployment)

### DeleteNamespacedDeployment

在Kubernetes上删除指定命名空间的部署的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespaceddeployment)

### ListNamespacedDeployment

在Kubernetes上列出指定命名空间的部署的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespaceddeployment)

### PatchNamespacedDeployment

在Kubernetes上给指定的命名空间的部署打补丁的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespaceddeployment)

### ReadNamespacedDeployment

读取Kubernetes上的指定命名空间的部署的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespaceddeployment)

### ReplaceNamespacedDeployment

在Kubernetes上替换指定命名空间的部署的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespaceddeployment)

## 作业（Job）

### CreateNamespacedJob

在Kubernetes上创建指定命名空间的作业的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespacedjob)

### DeleteNamespacedJob

在Kubernetes上删除指定命名空间的作业的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespacedjob)

### ListNamespacedJob

在Kubernetes上列出指定命名空间的作业的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespacedjob)

### PatchNamespacedJob

在Kubernetes上给指定的命名空间的作业打补丁的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespacedjob)

### ReadNamespacedJob

读取Kubernetes上的指定命名空间的作业的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespacedjob)

### ReplaceNamespacedJob

在Kubernetes上替换指定命名空间的作业的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespacedjob)

## Pod

### CreateNamespacedPod

在Kubernetes上创建指定命名空间的Pod的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespacedpod)

### DeleteNamespacedPod

在Kubernetes上删除指定命名空间的Pod的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespacedpod)

### ListNamespacedPod

在Kubernetes上列出指定命名空间的Pod的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespacedpod)

### PatchNamespacedPod

在Kubernetes上给指定的命名空间的Pod打补丁的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespacedpod)

### ReadNamespacedPod

读取Kubernetes上的指定命名空间的Pod的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespacedpod)

### ReplaceNamespacedPod

在Kubernetes上替换指定命名空间的Pod的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespacedpod)

## 服务（Service）

### CreateNamespacedService

在Kubernetes上创建指定命名空间的服务的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespacedservice)

### DeleteNamespacedService

在Kubernetes上删除指定命名空间的服务的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespacedservice)

### ListNamespacedService

在Kubernetes上列出指定命名空间的服务的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespacedservice)

### PatchNamespacedService

在Kubernetes上给指定的命名空间的服务打补丁的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespacedservice)

### ReadNamespacedService

读取Kubernetes上的指定命名空间的服务的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespacedservice)

### ReplaceNamespacedService

在Kubernetes上替换指定命名空间的服务的task。

[API参考文档](https://docs.prefect.io/api/latest/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespacedservice)

* [Prefect官网](https://www.prefect.io/)
* [英版原文](https://docs.prefect.io/core/task_library/kubernetes.html)
* [联系译者](https://github.com/listen-lavender)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://listen-lavender.gitbook.io/prefect-docs/tasklibrary/kubernetes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
