[Failed task] Deploy Nginx Web Server on Kubernetes Cluster

Hi guys,

I have a failed task but I dont know why. Could someone point out where did I go wrong, please ?

Some of the Nautilus team developers are developing a static website and they want to deploy it on Kubernetes cluster. They want it to be highly available and scalable. Therefore, based on the requirements, the DevOps team has decided to create deployment for it with multiple replicas. Below you can find more details about it:

Create a deployment using nginx image with latest tag only and remember to mention tag i.e nginx:latest and name it as nginx-deployment. App labels should be app: nginx-app and type: front-end. The container should be named as nginx-container; also make sure replica counts are 3.

Also create a service named nginx-service and type NodePort. The targetPort should be 80 and nodePort should be 30011.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.

The result is

Label app: nginx-app not found

Here is my script:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx-app
      type: front-end
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx-app
        type: front-end
    spec:
      containers:
      - name: nginx-container
        image: nginx:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  selector:
    app: nginx-app
    type: front-end
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30011

@Inderpreet
Can you give it a look, please ?

Hello, kahntran
Might be the reason is you didn’t add labels in deployment metadata section.

Hi @Tej-Singh-Rana,
Thanks for your kind reply.
I think the labels of the deployment is not mentioned, but name it as nginx-deployment .

Okay, They will look into it. If not given in the task description.

Thanks, I’m glad to hear that.