<p>When a serial port is created in a docker container mapped on a host with an operating system of Linux, this is done with the <code>‘—device’</code> flag;</p>

<p>e.g. <code>docker run -dit --device=/dev/ttyUSB0 --name SerialTest &lt;docker image&gt;</code></p>

<p>We would like to know how PODs can be mapped serial ports in Kubernetes. The figure below shows the Pod configuration for the application to be deployed in Rancher 2.x.</p>

<p>(<a href="https://i.stack.imgur.com/qhfll.png" rel="nofollow noreferrer">https://i.stack.imgur.com/qhfll.png</a>)</p>

<p>In node scheduling, we have configured pods to be distributed to specific nodes with serial ports. Also, it is of course not possible to map the serial port with the volume mount. So, I would like to raise a question because I couldn't find anything related to <code>‘—device’</code> flag of docker in my Rancher 2.x configuration.</p>

<p>(<a href="https://i.stack.imgur.com/mkr7t.png" rel="nofollow noreferrer">https://i.stack.imgur.com/mkr7t.png</a>) "Application configuration in Rancher 2.x"</p>

<p>(<a href="https://i.stack.imgur.com/Lfn0t.png" rel="nofollow noreferrer">https://i.stack.imgur.com/Lfn0t.png</a>) "Serial port device connected to the HOST PC"</p>

<p>(<a href="https://i.stack.imgur.com/bQMk4.png" rel="nofollow noreferrer">https://i.stack.imgur.com/bQMk4.png</a>) "Volume Mount Status of Containers in Deployed Pods"</p>

<p>(<a href="https://i.stack.imgur.com/yhWxv.png" rel="nofollow noreferrer">https://i.stack.imgur.com/yhWxv.png</a>) "Error log when running a .NET application that uses a serial port"</p>

uvclab
<p>Based on the goal of the <a href="https://i.stack.imgur.com/qhfll.png" rel="nofollow noreferrer">first diagram</a>: Kubernetes abstractions covering the communication between the pod and the outside world (for this matter, outside of the node) are meant to handle at least layer 2 communications (<em>veth</em>, as in inter-node/pod communication).</p>

<p>Is not detailed why is not possible to map the device volume in the pod, so I'm wondering if you have tried using privileged containers <a href="https://stackoverflow.com/a/42716234/10892354">like in this reference</a>:</p>

<pre><code>  containers:
  - name: acm
    securityContext:
      privileged: true
    volumeMounts:
    - mountPath: /dev/ttyACM0
      name: ttyacm
  volumes:
  - name: ttyacm
    hostPath:
      path: /dev/ttyACM0
</code></pre>

<p>It is possible for Rancher to <a href="https://forums.rancher.com/t/any-way-to-start-a-container-in-privileged-mode/6078" rel="nofollow noreferrer">start containers in privileged mode</a>.</p>
