Reputation: 657
I'm trying to move from php:7.1-apache image to php-fpm + nginx images, here is my current php deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: php
labels:
app: php
spec:
replicas: 1
selector:
matchLabels:
app: php
template:
metadata:
labels:
app: php
spec:
containers:
- image: php:7.1-apache
imagePullPolicy: Always
name: php
resources:
requests:
cpu: 200m
ports:
- containerPort: 80
name: php
volumeMounts:
- name: php-persistent-storage
mountPath: /var/www
volumes:
- name: php-persistent-storage
gcePersistentDisk:
pdName: php-phantomjs-disk
fsType: ext4
How can I mount the same gcePersistentDisk in the nginx deployment file?
Upvotes: 0
Views: 166
Reputation: 22922
what your'e asking about is one of the most common issues with containerized PHP apps. Sharing code/content between deployments is possible only with some PV types that support ReadWriteMany policy.
If you look at https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes you can see that gce disks do not allow for that.
What you can do is to use other type of persistent storage that supports RWX or move nginx and fpm into the same deployment as two separate containers (has its own pros and cons).
Upvotes: 1