Solutions to practice test - security context
Run the command ‘kubectl exec ubuntu-sleeper whoami’ and count the number of pods.
Set a security context to run as user 1010.
The User ID defined in the securityContext of the container overrides the User ID in the POD.
The User ID defined in the securityContext of the POD is carried over to all the PODs in the container.
Run kubectl exec -it ubuntu-sleeper – date -s ‘19 APR 2012 11:14:00’
Add SYS_TIME capability to the container’s securityContext
Now try to run the below command in the pod to set the date. If the security capability was added correctly, it should work. If it doesn’t make sure you changed the user back to root.