Lab 6 - Pod Configuration¶
30 min Intermediate
Problem¶
Write a Pod manifest named yoda-service-pod.yaml, create the Pod in the cluster, and prove it's configured correctly.
The Pod must meet these requirements:
- The Pod is named
yoda-serviceand uses the imagequay.io/nginx/nginx-unprivileged:1.29. You don't need a custom command or arguments. -
Configuration file: the container needs this configuration data:
Store it in a ConfigMap named
yoda-service-config, under the keyyoda.cfg, and mount it into the container so the file appears at/etc/yoda-service/yoda.cfg. -
Resources: the container requests
64Miof memory and250mof CPU, and is limited to128Miof memory and500mof CPU. - Secret: the container needs a database password,
0penSh1ftRul3s!. Store it in a Secret namedyoda-db-passwordunder the keypassword, and pass it to the container as the environment variableDB_PASSWORD. - Identity: the Pod runs as the ServiceAccount
yoda-svc. Create the ServiceAccount if it doesn't already exist.
Setup¶
Verification¶
# The configuration file is mounted
oc exec yoda-service -- cat /etc/yoda-service/yoda.cfg
# The secret is available as an environment variable
oc exec yoda-service -- printenv DB_PASSWORD
# The Pod runs as the right ServiceAccount
oc get pod yoda-service -o jsonpath='{.spec.serviceAccountName}{"\n"}'
# Requests and limits are set (QoS class "Burstable")
oc get pod yoda-service -o jsonpath='{.spec.containers[0].resources}{"\n"}{.status.qosClass}{"\n"}'