Skip to content

Commit 84179a7

Browse files
authored
Merge pull request #39517 from Zhuzhenghao/device-plugins
Clean up page device-plugins
2 parents c475d55 + d08ae65 commit 84179a7

File tree

1 file changed

+48
-50
lines changed

1 file changed

+48
-50
lines changed

content/en/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins.md

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -88,56 +88,56 @@ spec:
8888
The general workflow of a device plugin includes the following steps:
8989

9090
1. Initialization. During this phase, the device plugin performs vendor-specific
91-
initialization and setup to make sure the devices are in a ready state.
91+
initialization and setup to make sure the devices are in a ready state.
9292

9393
1. The plugin starts a gRPC service, with a Unix socket under the host path
94-
`/var/lib/kubelet/device-plugins/`, that implements the following interfaces:
95-
96-
```gRPC
97-
service DevicePlugin {
98-
// GetDevicePluginOptions returns options to be communicated with Device Manager.
99-
rpc GetDevicePluginOptions(Empty) returns (DevicePluginOptions) {}
100-
101-
// ListAndWatch returns a stream of List of Devices
102-
// Whenever a Device state change or a Device disappears, ListAndWatch
103-
// returns the new list
104-
rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {}
105-
106-
// Allocate is called during container creation so that the Device
107-
// Plugin can run device specific operations and instruct Kubelet
108-
// of the steps to make the Device available in the container
109-
rpc Allocate(AllocateRequest) returns (AllocateResponse) {}
110-
111-
// GetPreferredAllocation returns a preferred set of devices to allocate
112-
// from a list of available ones. The resulting preferred allocation is not
113-
// guaranteed to be the allocation ultimately performed by the
114-
// devicemanager. It is only designed to help the devicemanager make a more
115-
// informed allocation decision when possible.
116-
rpc GetPreferredAllocation(PreferredAllocationRequest) returns (PreferredAllocationResponse) {}
117-
118-
// PreStartContainer is called, if indicated by Device Plugin during registeration phase,
119-
// before each container start. Device plugin can run device specific operations
120-
// such as resetting the device before making devices available to the container.
121-
rpc PreStartContainer(PreStartContainerRequest) returns (PreStartContainerResponse) {}
122-
}
123-
```
124-
125-
{{< note >}}
126-
Plugins are not required to provide useful implementations for
127-
`GetPreferredAllocation()` or `PreStartContainer()`. Flags indicating
128-
the availability of these calls, if any, should be set in the `DevicePluginOptions`
129-
message sent back by a call to `GetDevicePluginOptions()`. The `kubelet` will
130-
always call `GetDevicePluginOptions()` to see which optional functions are
131-
available, before calling any of them directly.
132-
{{< /note >}}
94+
`/var/lib/kubelet/device-plugins/`, that implements the following interfaces:
95+
96+
```gRPC
97+
service DevicePlugin {
98+
// GetDevicePluginOptions returns options to be communicated with Device Manager.
99+
rpc GetDevicePluginOptions(Empty) returns (DevicePluginOptions) {}
100+
101+
// ListAndWatch returns a stream of List of Devices
102+
// Whenever a Device state change or a Device disappears, ListAndWatch
103+
// returns the new list
104+
rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {}
105+
106+
// Allocate is called during container creation so that the Device
107+
// Plugin can run device specific operations and instruct Kubelet
108+
// of the steps to make the Device available in the container
109+
rpc Allocate(AllocateRequest) returns (AllocateResponse) {}
110+
111+
// GetPreferredAllocation returns a preferred set of devices to allocate
112+
// from a list of available ones. The resulting preferred allocation is not
113+
// guaranteed to be the allocation ultimately performed by the
114+
// devicemanager. It is only designed to help the devicemanager make a more
115+
// informed allocation decision when possible.
116+
rpc GetPreferredAllocation(PreferredAllocationRequest) returns (PreferredAllocationResponse) {}
117+
118+
// PreStartContainer is called, if indicated by Device Plugin during registeration phase,
119+
// before each container start. Device plugin can run device specific operations
120+
// such as resetting the device before making devices available to the container.
121+
rpc PreStartContainer(PreStartContainerRequest) returns (PreStartContainerResponse) {}
122+
}
123+
```
124+
125+
{{< note >}}
126+
Plugins are not required to provide useful implementations for
127+
`GetPreferredAllocation()` or `PreStartContainer()`. Flags indicating
128+
the availability of these calls, if any, should be set in the `DevicePluginOptions`
129+
message sent back by a call to `GetDevicePluginOptions()`. The `kubelet` will
130+
always call `GetDevicePluginOptions()` to see which optional functions are
131+
available, before calling any of them directly.
132+
{{< /note >}}
133133

134134
1. The plugin registers itself with the kubelet through the Unix socket at host
135-
path `/var/lib/kubelet/device-plugins/kubelet.sock`.
135+
path `/var/lib/kubelet/device-plugins/kubelet.sock`.
136136

137-
{{< note >}}
138-
The ordering of the workflow is important. A plugin MUST start serving gRPC
139-
service before registering itself with kubelet for successful registration.
140-
{{< /note >}}
137+
{{< note >}}
138+
The ordering of the workflow is important. A plugin MUST start serving gRPC
139+
service before registering itself with kubelet for successful registration.
140+
{{< /note >}}
141141

142142
1. After successfully registering itself, the device plugin runs in serving mode, during which it keeps
143143
monitoring device health and reports back to the kubelet upon any device state changes.
@@ -297,7 +297,6 @@ However, calling `GetAllocatableResources` endpoint is not sufficient in case of
297297
update and Kubelet needs to be restarted to reflect the correct resource capacity and allocatable.
298298
{{< /note >}}
299299

300-
301300
```gRPC
302301
// AllocatableResourcesResponses contains informations about all the devices known by the kubelet
303302
message AllocatableResourcesResponse {
@@ -318,14 +317,14 @@ Preceding Kubernetes v1.23, to enable this feature `kubelet` must be started wit
318317
```
319318

320319
`ContainerDevices` do expose the topology information declaring to which NUMA cells the device is
321-
affine. The NUMA cells are identified using a opaque integer ID, which value is consistent to
320+
affine. The NUMA cells are identified using a opaque integer ID, which value is consistent to
322321
what device plugins report
323322
[when they register themselves to the kubelet](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-integration-with-the-topology-manager).
324323

325324
The gRPC service is served over a unix socket at `/var/lib/kubelet/pod-resources/kubelet.sock`.
326325
Monitoring agents for device plugin resources can be deployed as a daemon, or as a DaemonSet.
327326
The canonical directory `/var/lib/kubelet/pod-resources` requires privileged access, so monitoring
328-
agents must run in a privileged security context. If a device monitoring agent is running as a
327+
agents must run in a privileged security context. If a device monitoring agent is running as a
329328
DaemonSet, `/var/lib/kubelet/pod-resources` must be mounted as a
330329
{{< glossary_tooltip term_id="volume" >}} in the device monitoring agent's
331330
[PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core).
@@ -360,7 +359,7 @@ resource assignment decisions.
360359
`TopologyInfo` supports setting a `nodes` field to either `nil` or a list of NUMA nodes. This
361360
allows the Device Plugin to advertise a device that spans multiple NUMA nodes.
362361

363-
Setting `TopologyInfo` to `nil` or providing an empty list of NUMA nodes for a given device
362+
Setting `TopologyInfo` to `nil` or providing an empty list of NUMA nodes for a given device
364363
indicates that the Device Plugin does not have a NUMA affinity preference for that device.
365364

366365
An example `TopologyInfo` struct populated for a device by a Device Plugin:
@@ -396,4 +395,3 @@ Here are some examples of device plugin implementations:
396395
* Learn about the [Topology Manager](/docs/tasks/administer-cluster/topology-manager/)
397396
* Read about using [hardware acceleration for TLS ingress](/blog/2019/04/24/hardware-accelerated-ssl/tls-termination-in-ingress-controllers-using-kubernetes-device-plugins-and-runtimeclass/)
398397
with Kubernetes
399-

0 commit comments

Comments
 (0)