# 配备了特殊硬件的节点

在部分节点配备了特殊硬件（比如 GPU）的集群中， 我们希望不需要这类硬件的 Pod 不要被调度到这些特殊节点，以便为后继需要这类硬件的 Pod 保留资源。&#x20;

要达到这个目的，可以先**给配备了特殊硬件的节点添加污点** ：

```properties
kubectl taint nodes nodename special=true:NoSchedule
```

或者：

```properties
kubectl taint nodes nodename special=true:PreferNoSchedule
```

然后**给使用了这类特殊硬件的 Pod 添加一个相匹配的容忍度**。和专用节点的例子类似，添加这个容忍度的最简单的方法是使用自定义[准入控制器](https://kubernetes.io/zh-cn/docs/reference/access-authn-authz/admission-controllers/)。 比如，我们推荐使用[扩展资源](https://kubernetes.io/zh-cn/docs/concepts/configuration/manage-resources-containers/#extended-resources)来表示特殊硬件，给配置了特殊硬件的节点添加污点时包含扩展资源名称， 然后运行一个[ExtendedResourceToleration](https://kubernetes.io/zh-cn/docs/reference/access-authn-authz/admission-controllers/#extendedresourcetoleration)准入控制器。此时，因为节点已经被设置污点了，没有对应容忍度的 Pod 不会被调度到这些节点。

但当你创建一个使用了扩展资源的 Pod 时，ExtendedResourceToleration准入控制器会自动给 Pod 加上正确的容忍度，这样 Pod 就会被自动调度到这些配置了特殊硬件的节点上。 这种方式能够确保配置了特殊硬件的节点专门用于运行需要这些硬件的 Pod， 并且你无需手动给这些 Pod 添加容忍度。


---

# Agent Instructions: 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://bohans.gitbook.io/devops/kubernetes/ji-chu-zhi-shi/kubernetes-diao-du/taint-he-toleration/shi-yong-li-zi/pei-bei-le-te-shu-ying-jian-de-jie-dian.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.
