FROM php:7.2-fpm
RUN mkdir /app
COPY hello.php /app
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: web-deployment
labels:
app: web-server
spec:
replicas: 1
template:
metadata:
labels:
app: web-server
spec:
volumes:
# Create the shared files volume to be used in both pods
- name: shared-files
emptyDir: {}
- name: nginx-config-volume
configMap:
name: nginx-config
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
volumeMounts:
- name: shared-files
mountPath: /var/www/html
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: php-fpm
image: my-php-app:1.0.0
ports:
- containerPort: 80
volumeMounts:
- name: shared-files
mountPath: /var/www/html
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "cp -r /app/. /var/www/html"]
---
apiVersion: v1
kind: Service
metadata:
name: web-service
labels:
app: web-server
spec:
ports:
- port: 80
type: NodePort
selector:
app: web-server
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
data:
nginx.conf: |
events {
}
http {
server {
listen 80 default_server;
listen [::]:80 default_server;
# Set nginx to serve files from the shared volume!
root /var/www/html;
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;
}
}
}
kubectl create -f web.yaml
kubectl create -f configmap.yaml
minikube service web-service --url
Disclaimer for Confidential Information
The information contained in this email, and any attachments hereto, is strictly confidential and solely intended for use by the individual(s) and/or entity(s) to which it is addressed. If you have received this email in error, please notify the Admin Manager at in...@pacewisdom.com as soon as possible and delete this email immediately .The recipient of this email also acknowledges that Pace Wisdom Solutions Pvt Ltd., is unable to exercise control or ensure or guarantee the integrity of / over the contents of the information contained in e-mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Pace Wisdom Solutions. Thank you for your attention to this matter.