title: How to escalate kubernetes container privileges for pod securityContext runAsUser: 1010
body: <p>I have pod level security context like in below snippet:</p>
  
  <pre><code>spec:
    securityContext:
      runAsUser: 1010
      runAsGroup: 1010
      fsGroup: 1010
    containers:
         --------
         -------
  </code></pre>
  
  <p>one of my container need root privileges so I added one more securityContext as below:</p>
  
  <pre><code>   spec:
        securityContext:
          runAsUser: 1010
          runAsGroup: 1010
          fsGroup: 1010
        containers:
        - name: sample
          securityContext:
            runAsUser: 0
          image: sampleimage
          ----------------
          -----------------
  </code></pre>
  
  <p>Now my container is able to run with root privileges but my requirement is rather than making <strong>runAsUser: 0</strong> which is root! Is there any other way we can escalate privileges for container alone using same <strong>runAsUser: 1010</strong>  ?</p>
  
  <p>I found some options like <strong>allowPrivilegeEscalation:</strong> true &amp; <strong>capabilities:</strong> but no luck! maybe am using it in wrong way.</p>
  
  <pre><code>containers:
  - image: sampleimage
    name: sample
    securityContext:
      allowPrivilegeEscalation: true
  </code></pre>
  
  <p>AND</p>
  
  <pre><code>  containers:
    - image: sampleimage
      name: sample
      securityContext:
        capabilities:
          add: ["SYS_ADMIN"]
  </code></pre>
  
  <p>Can anyone help by correcting my code or help with an example to refer to and implement? Please.</p>