Hi @juliettet @rahul456 I have assigned a task named “Deploy Nginx and Phpfpm on Kubernetes” below are the configurations for the same.
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 8096;
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.
When I am trying to access the app, I am facing bad gateway error.
Any ideas?