SIMULATION
Task 16
Create a CronJob test-cron
Task information Details:
Create service account jupiter.
Grant anyuid SCC and cluster-admin to it.
Update CronJob cron-test to use that service account.
Solution:
Switch to the project hosting the cronjob, if needed:
oc project cron-test
Create the service account:
oc create sa jupiter
Grant anyuid:
oc adm policy add-scc-to-user anyuid -z jupiter -n cron-test
Grant cluster-admin:
oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:cron-test:jupiter
Update the cronjob:
oc patch cronjob cron-test -p '{'spec':{'jobTemplate':{'spec':{'template':{'spec':{'serviceAccountName':'jupiter'}}}}}}'
Verify:
oc get cronjob cron-test -o yaml | grep serviceAccountName
Notes:
The uploaded lab uses oc set sa cronjob.batch/cron-test jupiter, which is not the usual command form for CronJobs. Patching the pod template is the reliable method.
This task checks service account and privilege adjustments for scheduled workloads.