Task 03: Complete the https://jobs.local application

Change to the task_03 directory.

cd ../task_03

Review the modified VirtualServer.yaml manifest.

bat VirtualServer.yaml
../../_images/01_bat_virtualserver.jpg
k apply -f VirtualServer.yaml
../../_images/02_apply_virtualserver.jpg

Confirm the status of the virtualserver ‘my-virtualserver’ you just modified.

kubectl describe virtualserver my-virtualserver

Our environment now looks like this:

Outside K8s Cluster Inside K8s Cluster
https://jobs.local/get-job http://eclectic-jobs:3000/
https://jobs.local/add-job http://eclectic-jobs:3000/add-job
https://jobs.local/ http://myapp:3000

From the URL bar of the web browser, connect to the web application: https://jobs.local.

How does this work?

  • The client requests https://jobs.local
  • The request resolves to GET https://10.1.1.4:443 /
  • The request is received by the NGINX Plus ingress
  • The NGINX Plus ingress terminates TLS and then HTTP routes URL path ‘/’ to the myapp service
  • Embedded Javascript in the response HTML fetches a random job title from the https://jobs.local/get-job API endpoint
  • The NGINX Plus ingress rewrites URL path ‘/get-job’ to ‘/’ before sending to the eclectic-jobs service
  • The https://jobs.local web application styles and renders the JSON response from https://jobs.local/get-job
../../_images/03_jobs_local_browser.jpg

Press the [F5] key a few times to refresh the random job title and confirm the web application / api integration is working.