Please help in resolving below issue

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:

  1. Create a PersistentVolume named as pv-devops. 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/itadmin (this directory is already created, you might not be able to access it directly, so you need not to worry about it).
  2. Create a PersistentVolumeClaim named as pvc-devops. Configure the spec as storage class should be manual, request 1Gi of the storage, set access mode to ReadWriteOnce.
  3. Create a pod named as pod-devops, mount the persistent volume you created with claim name pvc-devops at document root of the web server, the container within the pod should be named as container-devops using image nginx with latest tag only (remember to mention the tag i.e nginx:latest).
  4. Create a node port type service named web-devops using node port 30008 to expose the web server running within the pod.

Note: The kubectl utility on jump_hos

solution

apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-devops
spec:
capacity:
storage: 4Gi
accessModes:
- ReadWriteOnce
storageClassName: manual
hostPath:
path: /mnt/itadmin
type: “”


apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-devops
spec:
accessModes:
- ReadWriteOnce
storageClassName: manual
resources:
requests:
storage: 1Gi


apiVersion: v1
kind: Pod
metadata:
name: pod-devops
labels:
app: devops
spec:
containers:
- name: container-devops
image: nginx:latest
volumeMounts:
- name: data
mountPath: /usr/share/nginx/html
volumes:
- name: data
persistentVolumeClaim:
claimName: pvc-devops


apiVersion: v1
kind: Service
metadata:
name: web-devops
spec:
type: NodePort
selector:
app: devops
ports:
- name: http
port: 80
targetPort: 80

error i am getting

Please provide where i am getting wrong.

Please paste YAML as code blocks so it does not lose formatting and indentation - like this

apiVersion: v1
kind: Service
metadata:
  name: web-devops
spec:
  type: NodePort
  selector:
    app: devops
  ports:
  - name: http
    port: 80
    targetPort: 80

The first thing I notice is that your service does not meet the requirement. You have not defined the required node port.