在 Kubelet 配置中指定扩展资源

Specifying Extended Resources in Kubelet Configuration

是否可以在 Kubelet 配置中指定扩展资源,或者这是否需要使用诸如守护程序 pod 之类的东西来实现?

本文中的扩展资源指的是:https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/。此页面指定通告这些资源的方式是向节点 /status 端点发送补丁,如下所示:

curl --header "Content-Type: application/json-patch+json" \ --request PATCH \ --data '[{"op": "add", "path": "/status/capacity/example.com~1dongle", "value": "4"}]' \ http://localhost:8001/api/v1/nodes/<your-node-name>/status

Is it possible to specify extended resources in Kubelet configuration or would this need to be achieved using something like a daemon pod?

不,扩展资源不能只在Kubelet配置中指定。如果你想永久配置它们,你可以使用Device Plugins

You can deploy a device plugin as a DaemonSet, as a package for your node’s operating system, or manually.

The canonical directory /var/lib/kubelet/device-plugins requires privileged access, so a device plugin must run in a privileged security context. If you’re deploying a device plugin as a DaemonSet, /var/lib/kubelet/device-plugins must be mounted as a Volume in the plugin’s PodSpec.

If you choose the DaemonSet approach you can rely on Kubernetes to: place the device plugin’s Pod onto Nodes, to restart the daemon Pod after failure, and to help automate upgrades.