<p>I setup kubernetes with master and node on the same hardware (ubuntu 18) using this <a href="https://powerodit.ch/2017/10/29/all-in-one-kubernetes-cluster-with-kubeadm/" rel="nofollow noreferrer">tutorial</a>.</p>

<p>Kubernetes 1.15.3
docker 19.03.2</p>

<p>The container I created runs an emulation software that needs root privileges with write access to /proc/sys/kernel directory.  When kubernetes start the container I get an error inside the service script /etc/init.d/myservicescript indicates that it can't write to /proc/sys/kernel/xxx.  The container runs on ubuntu 14.</p>

<p>I tried to set the "runAsUser: 0" in the pod's yaml file</p>

<p>I tried to set "USER 0" in the Dockerfile</p>

<p>Neither work.  Any suggestion on how to get this working?  </p>

<p>Changing the user inside the container does not give you any privilege on the host. In order to get elevated privilege, you must set <code>privileged: true</code> in the security context.</p>

<p>For example:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: busybox
spec:
  containers:
  - name: busybox
    image: busybox
    args:
    - sleep
    - "999"
    securityContext:
      privileged: true
</code></pre>
