Please reassign the task

Hi @Inderpreet @rahul456 “Deploy Nginx and Phpfpm on Kubernetes”

I have configured the things in correct manner and copied the file in the end in the container too.

apiVersion: v1
kind: Service
metadata:
name: app-service
spec:
type: NodePort
selector:
app: nginx
ports:

  • port: 80
    targetPort: 80
    nodePort: 30012

apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: |
events {}
http {
server {
listen 8099;
index index.html index.htm index.php;
root /var/www/html;
location ~ .php$ {
include fastcgi_params;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}
}

apiVersion: v1
kind: Pod
metadata:
name: nginx-phpfpm
labels:
app: nginx
spec:
volumes:

  • name: shared-files
    emptyDir: {}
  • name: nginx-config-volume
    configMap:
    name: nginx-config
    containers:
  • name: nginx-container
    image: nginx:latest
    volumeMounts:
  • name: shared-files
    mountPath: /var/www/html
  • name: nginx-config-volume
    mountPath: /etc/nginx/nginx.conf
    subPath: nginx.conf
  • name: php-fpm-container
    image: php:7.1-fpm
    volumeMounts:
  • name: shared-files
    mountPath: /var/www/html

I have also copied the file from jump host to the respective container.

But as per the given question the nodeport should be 30012, which I have written. As there were no details given for targetport and port hence I used 80.

But unfortunately, the task failed.

My ask here is why you haven’t mentioned in the question to set which port number to set?:slightly_smiling_face:

I have posted the solution in the review and hence I have got this feedback.

Is it possible rollback the task and reassign to me again or update the question for future?

Hello @Ashu27
Can you please share your review link? I need to check first.

Regards,
KodeKloud Support

Hi @Tej_Singh_Rana

Here’s the link:

We haven’t mentioned the service port number because, at this point, we want to check k8s knowledge.
As you already know that nginx’s default port is 80 and if you are changing to 8099 in the config file then we need to do similar changes in the service spec.ports.port field also because after changes, pod listens on 8099.

Regards,
KodeKloud Support

Are you able to access the application?

As I tried to access the application, it was throwing 502 bad gateway error.

Please accept this suggestion and reattempt it.

I can see that the task is under review