Deploy Nginx Web Server on Kubernetes Cluster Label (app: nginx-app not found)

Hi,
@player001 @Inderpreet @devops503

I got a failed task says: app: (nginx-app not found)

here is my output:


Can anyone help me out here what I did wrong?

Hi @tylorC,

You have to add Label app: nginx-app to your deployment:
1/ You can add It in the configuration file, check the following example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx-app
  template:
    metadata:
      labels:
        app: nginx-app
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

To see the labels automatically generated for each Pod, run kubectl get pods --show-labels

2/ or you can add it on the fly through kubectl label command.
Check It in the documentation:

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#label

thanks for your reply !