问题
Is it possible to map, the device port(USB port) of a worker node, to a POD?
Similar to docker create --device=/dev/ttyACM0:/dev/ttyACM0
Is it possible? I checked the refence doc, but could not find anything.
In Docker service, is it possible to map --device port
to service container(if I am running only 1 container)?
回答1:
You can actually get this to work. You need to run the container privileged and use a hostPath like this:
containers:
- name: acm
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev/ttyACM0
name: ttyacm
volumes:
- name: ttyacm
hostPath:
path: /dev/ttyACM0
回答2:
seems that this is not possible. The related API definition documentation for the v1.Container objects doesn't contain any container engine specific parameters or any parameters which are passed to the arguments of the container engine (click).
Also the shorthand imperative kubectl run ...
doesn't provide any arguments which are passed to the container engine (here's the documentation).
While this doesn't solve you problem, I hope my answer still helps you to answer similar questions with the help of the documentation.
来源:https://stackoverflow.com/questions/42697985/kubernetes-node-device-port-usb-mapping-to-pod-or-swarm-service-device-mapp