Lab 1 - Pod Creation¶
15 min Beginner
Problem¶
Write a Pod manifest in a file named yoda-service-pod.yaml, then create the Pod in the cluster to prove it works.
The Pod must meet these requirements:
- The Pod is named
yoda-serviceand has the labelapp: yoda. - It runs in a project (namespace) named
web. - It uses the
quay.io/nginx/nginx-unprivileged:1.29container image. - The container exposes
containerPort8080. - The container's command is
nginx, with the arguments-ganddaemon off;, so nginx runs in the foreground.
Why port 8080 and not 80?
OpenShift runs containers as a random, non-root user, and non-root processes can't bind to ports below 1024. OpenShift-friendly images, such as nginx-unprivileged or Red Hat's UBI images, listen on a high port such as 8080 instead.
Setup¶
Verification¶
The Pod should reach the Running state with 1/1 containers ready:
Forward a local port to the Pod and request the nginx welcome page. Run oc port-forward in one terminal and curl in another: