Instructions were:
The Nautilus DevOps team is working on a Kubernetes template to deploy a web application on the cluster. There are some requirements to create/use persistent volumes to store the application code, and the template needs to be designed accordingly. Please find more details below:
Create a PersistentVolume named as pv-xfusion. Configure the spec as storage class should be manual, set capacity to 4Gi, set access mode to ReadWriteOnce, volume type should be hostPath and set path to /mnt/devops (this directory is already created, you might not be able to access it directly, so you need not to worry about it).
Create a PersistentVolumeClaim named as pvc-xfusion. Configure the spec as storage class should be manual, request 2Gi of the storage, set access mode to ReadWriteOnce.
Create a pod named as pod-xfusion, mount the persistent volume you created with claim name pvc-xfusion at document root of the web server, the container within the pod should be named as container-xfusion using image httpd with latest tag only (remember to mention the tag i.e httpd:latest).
Create a node port type service named web-xfusion using node port 30008 to expose the web server running within the pod.
Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.
I created the app.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-xfusion
spec:
capacity:
storage: 4Gi
accessModes:
- ReadWriteOnce
storageClassName: manual
hostPath:
path: /mnt/devops
type: “”
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-xfusion
spec:
accessModes:
- ReadWriteOnce
storageClassName: manual
resources:
requests:
storage: 2Gi
apiVersion: v1
kind: Pod
metadata:
name: pod-xfusion
spec:
containers:
- name: container-xfusion
image: httpd:latest
volumeMounts:
- name: data
mountPath: /usr/local/apache2/htdocs/
volumes:
- name: data
persistentVolumeClaim:
claimName: pvc-xfusion
apiVersion: v1
kind: Service
metadata:
name: web-xfusion
spec:
type: NodePort
selector:
app: xfusion
ports:
- name: http
port: 80
targetPort: 80
nodePort: 30008
I verified all resources are running, pod is running, PV/PVC are bound. Service is using correct port. Plus the error only says the issue is about web nto accesible. i checked the logs, and it seems like something is wrong with server name which is under control of Kodekloud, and out of my control.
Then I check logs:
This seems to be out of scope of the requirements/instructions.
Please check.