1/22
Looks like no tags are added yet.
Configure an HTPasswd identity provider named htpass-ex280 with secret htpass-idp-ex280 and the required users.
Create the password file: htpasswd -cB htpasswd_file jobs htpasswd -B htpasswd_file wozniak htpasswd -B htpasswd_file collins htpasswd -B htpasswd_file adlerin htpasswd -B htpasswd_file armstrong
Enter each requested password interactively, or use -b only if exposing passwords in shell history is acceptable.
Create the secret: oc create secret generic htpass-idp-ex280 \ --from-file=htpasswd=htpasswd_file \ -n openshift-config
Configure OAuth: oc edit oauth cluster
Add an identity provider entry with: name: htpass-ex280 mappingMethod: claim type: HTPasswd htpasswd.fileData.name: htpass-idp-ex280
Verify: oc get oauth cluster -o yaml Log in once with each created account.
Configure cluster permissions: jobs is cluster-admin, only wozniak may self-provision projects, wozniak is not a cluster administrator, and remove kubeadmin access.
Grant cluster administration: oc adm policy add-cluster-role-to-user cluster-admin jobs
Disable project self-provisioning for all authenticated OAuth users: oc adm policy remove-cluster-role-from-group self-provisioner system:authenticated:oauth
Allow only wozniak to self-provision: oc adm policy add-cluster-role-to-user self-provisioner wozniak
Confirm wozniak does not have cluster-admin: oc auth can-i '' '' --as=wozniak --all-namespaces
Remove kubeadmin after verifying another cluster-admin login: oc delete secret kubeadmin -n kube-system
Verify: oc auth can-i create project.project.openshift.io --as=wozniak oc auth can-i create project.project.openshift.io --as=armstrong
Create the apollo, titan, gemini, bluebook, and apache projects, then configure project-level user permissions.
Create the projects: for p in apollo titan gemini bluebook apache; do oc new-project "$p" done
Make armstrong administrator of apollo and titan: oc adm policy add-role-to-user admin armstrong -n apollo oc adm policy add-role-to-user admin armstrong -n titan
Allow collins to view apollo: oc adm policy add-role-to-user view collins -n apollo
Verify: oc auth can-i '' '' -n apollo --as=armstrong oc auth can-i get pods -n apollo --as=collins oc auth can-i create deployments -n apollo --as=collins
Create commander and pilot groups, assign users, and grant project permissions.
Create groups and membership: oc adm groups new commander wozniak oc adm groups new pilot adlerin
Alternatively, create empty groups and add users: oc adm groups new commander oc adm groups add-users commander wozniak oc adm groups new pilot oc adm groups add-users pilot adlerin
Grant commander edit access: oc adm policy add-role-to-group edit commander -n apollo oc adm policy add-role-to-group edit commander -n titan
Grant pilot view-only access to apollo: oc adm policy add-role-to-group view pilot -n apollo
Verify: oc get groups oc auth can-i create deployments -n apollo --as=wozniak oc auth can-i get pods -n apollo --as=adlerin oc auth can-i create deployments -n apollo --as=adlerin
Create ResourceQuota ex280-quota in project manhattan with CPU, memory, pod, service, and replication controller limits.
oc create quota ex280-quota \ --hard=cpu=2,memory=1Gi,pods=3,services=6,replicationcontrollers=3 \ -n manhattan
Verify: oc describe resourcequota ex280-quota -n manhattan oc get resourcequota ex280-quota -n manhattan -o yaml
Create LimitRange ex280-limits in bluebook for Pod and Container CPU and memory constraints.
Create ex280-limits.yaml: apiVersion: v1 kind: LimitRange metadata: name: ex280-limits namespace: bluebook spec: limits:
Apply and verify: oc apply -f ex280-limits.yaml oc describe limitrange ex280-limits -n bluebook
Troubleshoot the rocky application in bluewills so it runs with the magic service account and is reachable by route.
oc project bluewills
oc get pods
oc logs pod/
Create the service account and grant anyuid: oc create serviceaccount magic oc adm policy add-scc-to-user anyuid -z magic
Assign it to the workload:
oc set serviceaccount deployment/
If a service does not exist:
oc expose deployment/
Expose the service as a route:
oc expose service/
Verify: oc get pods,svc,route curl http://rocky.apps.ocp4.example.com
Create a secure edge route for oxcart in area51 using the supplied certificate and private key.
oc project area51 oc get deployment,service,route
Remove an incorrect existing route if necessary:
oc delete route
Create the edge-terminated route:
oc create route edge
Verify:
oc get route
The certificate subject or SAN must match oxcart.apps.ocp4.example.com.
Scale the hydra application in lerna to five replicas.
oc project lerna oc scale deployment/hydra --replicas=5
Verify: oc get deployment hydra oc get pods
Configure horizontal autoscaling for scala in gru with 6-40 replicas, 60% CPU utilization, 25m CPU request, and 100m CPU limit.
oc project gru
Set resources first, because CPU-based HPA requires a CPU request: oc set resources deployment/scala \ --requests=cpu=25m \ --limits=cpu=100m
Create the HPA: oc autoscale deployment/scala \ --min=6 \ --max=40 \ --cpu-percent=60
Verify: oc get hpa oc describe hpa scala oc get deployment scala -o jsonpath='{.spec.template.spec.containers[*].resources}'
Create secret magic in the math project with the required Decoder_Ring key and value.
oc create secret generic magic \ --from-literal=Decoder_Ring='ASDA142hfh-gfrhhueo-erfdk345v' \ -n math
Verify without printing the decoded secret value: oc describe secret magic -n math oc get secret magic -n math -o jsonpath='{.data.Decoder_Ring}' | wc -c
Inject all keys from secret magic as environment variables into the qed application in math.
oc project math oc set env deployment/qed --from=secret/magic
If the workload is a DeploymentConfig instead: oc set env dc/qed --from=secret/magic
Verify: oc set env deployment/qed --list oc rollout status deployment/qed oc logs deployment/qed
Confirm that the application no longer reports: App is not configured properly.
Create service account ex-280-sa in apples and allow workloads using it to run with any user ID.
oc project apples oc create serviceaccount ex-280-sa oc adm policy add-scc-to-user anyuid -z ex-280-sa
Assign it to the required workload:
oc set serviceaccount deployment/
For a DeploymentConfig:
oc set serviceaccount dc/
Verify:
oc adm policy who-can use scc anyuid
oc get deployment/
Repair the oranges application in apples and run it with service account ex-280-sa.
oc project apples oc get deployment,dc,service,pods
Inspect selector and labels: oc describe service oranges oc get deployment oranges -o jsonpath='{.spec.selector}'
If the Service selector is incorrect, edit it so it matches the workload pod labels: oc edit service/oranges
Assign the service account: oc set serviceaccount deployment/oranges ex-280-sa
For a DeploymentConfig: oc set serviceaccount dc/oranges ex-280-sa
Verify: oc rollout status deployment/oranges oc get pods,service,endpoints
Troubleshoot an application that cannot schedule because its memory request is unrealistically high.
Select the project and inspect the workload:
oc project
Inspect configured resources:
oc get deployment/
Correct the memory request or limit, for example from 80Gi to 1Gi:
oc set resources deployment/
If it is a DeploymentConfig:
oc set resources dc/
Verify:
oc rollout status deployment/
Troubleshoot an application that cannot schedule because its CPU request is unrealistically high.
Inspect the pod and recent scheduling events:
oc describe pod/
Inspect resources:
oc get deployment/
Correct the CPU request, for example from 100 cores to 10m:
oc set resources deployment/
If it is a DeploymentConfig:
oc set resources dc/
Verify:
oc rollout status deployment/
Create a NetworkPolicy in database that permits ingress on TCP 8080 only from checker pods matching namespace label team=devsecops and pod label deployment=web-mysql.
First verify labels: oc get namespace checker --show-labels oc get pods -n checker --show-labels oc get pods -n database --show-labels
Create allow-checker.yaml and set the target podSelector to the actual database pod label:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-checker
namespace: database
spec:
podSelector:
matchLabels:
Apply: oc apply -f allow-checker.yaml
Verify from a matching checker pod:
oc exec -n checker
Deploy a movie-site application from a supplied Helm repository into the target project.
Add and refresh the repository: helm repo add redhat-movie-repo http://charts.ocp4.example.com/charts/ helm repo update
Find the chart: helm search repo redhat-movie-repo
Install it:
helm install movie-site redhat-movie-repo/
Verify:
helm list -n
Configure a TCP liveness probe on port 8080 with initial delay 10 seconds and timeout 30 seconds.
For a Deployment: oc set probe deployment/atlas \ --liveness \ --open-tcp=8080 \ --initial-delay-seconds=10 \ --timeout-seconds=30 \ -n mercury
For a DeploymentConfig: oc set probe dc/atlas \ --liveness \ --open-tcp=8080 \ --initial-delay-seconds=10 \ --timeout-seconds=30 \ -n mercury
Verify: oc get deployment atlas -n mercury -o yaml oc describe pod -n mercury -l deployment=atlas
Collect an OpenShift must-gather, archive it with the cluster ID in the filename, and upload it with the supplied script.
Get the cluster ID: CLUSTER_ID=$(oc get clusterversion version -o jsonpath='{.spec.clusterID}')
Collect diagnostics: oc adm must-gather
Identify the generated directory: MG_DIR=$(find . -maxdepth 1 -type d -name 'must-gather.local.*' | head -1)
Create a compressed archive: tar -cvaf "must-gather.CLUSTERID.tar.gz""MG_DIR"
Upload with the exam-provided script: /path/to/uploadscript.sh "must-gather.${CLUSTER_ID}.tar.gz"
Verify: ls -lh "must-gather.${CLUSTER_ID}.tar.gz"
Create a CronJob from the CLI with a supplied image and schedule, then configure its service account and job history.
Create a service account if required:
oc create serviceaccount
Grant only the SCC required by the task. Example for privileged:
oc adm policy add-scc-to-user privileged \
-z
Generate the CronJob manifest:
oc create cronjob
Edit cronjob.yaml and set under spec.jobTemplate.spec.template.spec:
serviceAccountName:
Set the requested history field under spec, for example:
successfulJobsHistoryLimit:
Apply and verify:
oc apply -f cronjob.yaml -n
Create and configure a custom OpenShift project request template containing a LimitRange.
Generate the default project template: oc adm create-bootstrap-project-template -o yaml > mytemplate.yaml
Create the required LimitRange separately, then copy its object into the template's objects list. Parameterize it: metadata: name: ${PROJECT_NAME}-limit namespace: ${PROJECT_NAME}
Create the template in openshift-config: oc create -f mytemplate.yaml -n openshift-config
Configure the cluster to use it:
oc patch projects.config.openshift.io cluster \
--type=merge \
-p '{"spec":{"projectRequestTemplate":{"name":"
Verify configuration: oc get projects.config.openshift.io cluster \ -o jsonpath='{.spec.projectRequestTemplate.name}{"\n"}'
Test with a non-admin user by requesting a new project, then check that its LimitRange exists:
oc get limitrange -n
Troubleshoot Pending, CrashLoopBackOff, and route-without-endpoints application failures.
If nodeSelector cannot match any node, correct the workload selector or label the intended node:
oc label node
If resources are insufficient, reduce unrealistic requests/limits:
oc set resources deployment/
If the image requires a non-default UID, create a service account, grant the narrowly required SCC, and assign it:
oc create serviceaccount
If endpoints are empty, make the Service selector match the pod labels:
oc edit service/
Final verification:
oc get pods,service,endpoints,route
curl -k https://
#