What UID will containers container1 and container2 run as? Security context can be defined in pod- or container-level. The latter takes precedence. In the example below, container1 will override the pod security context and run the container as UID 0 (root), while container2 will inherit the security context from the pod and run the container as UID 1001.
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
securityContext:
runAsUser: 1001
containers:
- image: ubuntu
name: container1
command: ["sleep", "5000"]
securityContext:
runAsUser: 0
- image: ubuntu
name: container2
command: ["sleep", "5000"]