🟧 CKA 2025 — Q-07

Question

Reconfigure the existing Deployment front-end in namespace sp-culator to expose port 80/tcp on the existing container nginx.

Create a new Service named front-end-svc exposing the container port 80/tcp.

Configure the new Service to also expose the individual Pods using a NodePort service.


✅ 1) Edit the Deployment to expose container port 80

kubectl edit deploy front-end -n sp-culator

Under the container spec (containers[0]), ensure:

ports:
- containerPort: 80
  protocol: TCP

Save & exit.


✅ 2) Create a NodePort Service exposing port 80

We need:

  • name: front-end-svc
  • type: NodePort
  • port: 80
  • targetPort: 80

Imperative (fastest for exam):

kubectl expose deploy front-end \
  -n sp-culator \
  --name=front-end-svc \
  --type=NodePort