I completed this task. However when I looked at the mounted path, I don;t see any html file. The mount is blank. Although PV and PVC worked fine and after pod started running I see that PVC is bound. However in the pod at mount point I don;t see any index file due to which running curl command provides below output-
403 Forbidden
403 Forbidden
nginx/1.23.1
Could you please make sure mount location has required files for this task?
Create PV based on the requirement, you can use the template here Persistent Volumes | Kubernetes and populate fields (name, storage class, size…) as the question.
Then create the PV
Create PVC based on the requirement, the template can be found here: Persistent Volumes | Kubernetes
Create the PVC and make sure it is successfully Bound.
Create the pod and mount the PVC as volume, follow the template here: Persistent Volumes | Kubernetes
Notes: image should be httpd:latest.
Create the pod and wait for it to run (state should be Running).
Expse the pod with service, use kubectl expose pod pod-name --type=NodePort --name=service-name --port=80 --dry-run=client -o yaml > svc.yaml
Then modify the YAML and assign the nodePort (port provided in the question).
Finally, create the svc, and verify the lab result.
Hope you can clear this task, if you have any issues, let me know.
Thank you for your response. I am aware of the steps. I see that PVC is getting bound to the pod. However I am expecting to see an index.html file in the document root which I don;t see and because of that curl command to masternode:nodeport doesnt work. I looked at the mount location inside pod and i don’t see any files in there.
Could you please confirm that mount location on host has necessary files ?