Hi Team,
PODs are running fine. Please let me know what has to be checked in this task.
Hi Team,
PODs are running fine. Please let me know what has to be checked in this task.
Can you share more details? What is the task and what is the error you are getting.
Hi,
You need to fix the VolumeMounts in the pod. In pod two containers are there. We have volume mounts that need to fix the issue.
The pod name is nginx-phpfpm and configmap name is nginx-config, Nginx is running on port 8099. Figure out the issues and fix them.
Once you think issue is fixed copy /tmp/index.php from jump host to nginx-container under nginx document root and try to curl the nginx URL from nginx-container itself, you should be able to run the php page you copied. This step isn’t mandatory but it will be helpful to test the setup.
What has to be checked here
–>kubectl get configmap nginx-config -o yaml
apiVersion: v1
data:
nginx.conf: |
events {
}
http {
server {
listen 8099 default_server;
listen [::]:8099 default_server;
# Set nginx to serve files from the shared volume!
root /var/www/html;
index index.html index.htm index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
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;
}
}
}
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{“apiVersion”:“v1”,“data”:{“nginx.conf”:“events {\n}\nhttp {\n server {\n listen 8099 default_server;\n listen [::]:8099 default_server;\n\n # Set nginx to serve files from the shared volume!\n root /var/www/html;\n index index.html index.htm index.php;\n server_name_;\n location / {\n try_files $uri $uri/ =404;\n }\n location ~ \.php$ {\n include fastcgi_params;\n fastcgi_param REQUEST_METHOD $request_method;\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n fastcgi_pass 127.0.0.1:9000;\n }\n }\n}\n”},“kind”:“ConfigMap”,“metadata”:{“annotations”:{},“name”:“nginx-config”,“namespace”:“default”}}
creationTimestamp: “2020-11-17T11:28:57Z”
name: nginx-config
namespace: default
resourceVersion: “417”
selfLink: /api/v1/namespaces/default/configmaps/nginx-config
uid: 867fda27-7632-488a-b2f4-bb5cf8693809
In your deployment config file check the volume is mounted to this location : /var/www/html.
If not you will have edit the location or recreate the Pod with new location.
Hi,
The nginx config sets the document root to /var/www/html however the volume is mounted at /usr/share/www/html. Delete the pod and set the nginx-container volume mount to /var/www/html. Then copy the index.php file and curl localhost:8099 from the nginx-container. You should be able to view the php you copied.