Kubernetes node Device port (USB) mapping to POD? Or Swarm service --device mapping

爱⌒轻易说出口 提交于 2020-01-21 12:26:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!