Lab 1 Solution - Pod Creation¶
yoda-service-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: yoda-service
namespace: web
labels:
app: yoda
spec:
containers:
- name: nginx
image: quay.io/nginx/nginx-unprivileged:1.29
command: ["nginx"]
args: ["-g", "daemon off;"]
ports:
- containerPort: 8080
Tip
command overrides the image's ENTRYPOINT, and args overrides its CMD. The -g "daemon off;" directive keeps nginx in the foreground. If it forked into the background, the container's main process would exit and the Pod would restart over and over.