b.kamal
October 15, 2020, 1:04pm
#1
Hi all,
Two days before, I have been assigned the task : Deploy Nginx and Phpfpm on Kubernetes. But I think that the image asked to deploy has an issue, each time I tried to deploy the pod I got this error :
To give you an idea about what I’ve done, I have just referred to the below link PHP-FPM, Nginx, Kubernetes, and Docker - Kubernetes Book
b.kamal
October 15, 2020, 4:49pm
#2
@b.kamal , can you please share you yml file ?
b.kamal
October 15, 2020, 5:27pm
#4
Hi @rahul456 , thank you your reply. My script looks like this :
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
data:
nginx.conf: |
events {
}
http {
server {
listen 8096 default_server;
listen [::]:8096 default_server;
# Set nginx to serve files from the shared volume!
root /var/www/html;
index index.php index.html index.hml;
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: Pod
apiVersion: v1
metadata:
name: nginx-phpfpm
spec:
volumes:
- name: shared-files
emptyDir: {}
- name: nginx-config-volume
configMap:
name: nginx-config
containers:
- image: php:7.2-fpm
name: php-fpm-container
volumeMounts:
- name: shared-files
mountPath: /var/www/html
lifecycle:
postStart:
exec:
command: [“/bin/sh”, “-c”, “cp -r /app/. /var/www/html”]
- image: nginx:latest
name: nginx-container
volumeMounts:
- name: shared-files
mountPath: /var/www/html
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
@b.kamal , as per question, you need not to run any command in yml template.
b.kamal
October 15, 2020, 5:48pm
#6
Ok, understood, thank you for your precious support