Security context in Kubernetes?

Edit the pod ubuntu-sleeper to run the sleep process with user ID 1010.

Note: Only make the necessary changes. Do not modify the name or image of the pod.

  • Pod Name: ubuntu-sleeper
  • Image Name: ubuntu
  • SecurityContext: User 1010

Solution: search for securityContext and add below details to yaml file. Delete the old pod then apply new config

spec:
  securityContext:
    runAsUser: 1010


controlplane ~ ???  kubectl delete pod ubuntu-sleeper 
pod "ubuntu-sleeper" deleted


controlplane ~ ??? kubectl apply -f /tmp/kubectl-edit-1358357322.yaml
pod/ubuntu-sleeper created

How to add user privileges at container level?

Website