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

3/9/2017

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)?

-- jisan
docker
kubernetes
kubernetes-pod
swarm

2 Answers

3/10/2017

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
-- Janos Lenart
Source: StackOverflow

3/9/2017

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.

-- pagid
Source: StackOverflow