Need help with task "Fix issue with PhpFpm Application Deployed on Kubernetes "

Hi guys,

looks like I configured all correctly, but the website is giving a forbidden error

Looks like something is missing, but unable to figure out what’s wrong in my steps.

please assist on above

Hi All,
just sharing my steps here.

  1. First corrected the port number in services to 80. using kubectl edit service nginx-service and changed : Port, Targetport to 80
  2. Copied index file from /tmp/index.php to the pods /var/www/html/ by using kubectl cp /tmp/index.php nginx-phpfpm-dp-5cccd45499-snn6m:/var/www/html/ -c nginx-continer
  3. added index.php to configmap as it only have index.html and index.htm. Kubectl edit configmap nginx-config
  4. After that I can access website using /index.php but getting forbidden error while accessing the URL directly

Hi
any ideas on how to fix this? I have this same issue

Hi Faisal,
If you are getting similar error try the following

kubectl rollout restart deployment nginx-phpfpm-dp
and Copy the index.php again to the nginx-container This will fix the issue

let me know how it goes.

Thank you

1 Like

Thanks a lot sumesh, it really helped me. is it necessary to always do this for deployments?

Hi Faisal,

This command help to restart the deployment and we can use the command “kubectl rollout restart ”
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-restart-em-

no need to apply this on all cases, as I used in most case as a last resource if nothing works even if we follow every steps

thanks @sumeshsundar.k It helped me to solve my issue

kubectl rollout restart deployment nginx-phpfpm-dp

it helped me too

Thank you
Guru

Kindly let me know using which URL we can check the application status

I tried restart the deployment and used below command but still getting error. Kindly let me know what mistake I am doing

thor@jump_host ~$ kubectl rollout restart deployment nginx-phpfpm-dp
deployment.apps/nginx-phpfpm-dp restarted
thor@jump_host ~$ curl http://kodekloud-control-plane:30008
curl: (7) Failed connect to kodekloud-control-plane:30008; Connection refused
thor@jump_host ~$ curl http://kodekloud-control-plane:30008
curl: (7) Failed connect to kodekloud-control-plane:30008; Connection refused
thor@jump_host ~$ curl http://kodekloud-control-plane:30008
curl: (7) Failed connect to kodekloud-control-plane:30008; Connection refused
thor@jump_host ~$ curl http://kodekloud-control-plane:30008

403 Forbidden

403 Forbidden


nginx/1.23.4 thor@jump_host ~$

Also need to run this command “kubectl rollout restart deployment/nginx-phpfpm-dp”