
This ensures nfs-common is installed on GCE, and provides a more functional explanation/example. I launched two replication controllers so that there were busybox pods to poke around at the NFS volume, and so that the later wget actually works (the original example would have to work on the node, or need some other access to the container network). After switching to two controllers, it actually makes more sense to use PV claims, and it's probably a configuration that makes more sense for indirection for NFS anyways.
31 lines
660 B
YAML
31 lines
660 B
YAML
# This pod mounts the nfs volume claim into /usr/share/nginx/html and
|
|
# serves a simple web page.
|
|
|
|
apiVersion: v1
|
|
kind: ReplicationController
|
|
metadata:
|
|
name: nfs-web
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
role: web-frontend
|
|
template:
|
|
metadata:
|
|
labels:
|
|
role: web-frontend
|
|
spec:
|
|
containers:
|
|
- name: web
|
|
image: nginx
|
|
ports:
|
|
- name: web
|
|
containerPort: 80
|
|
volumeMounts:
|
|
# name must match the volume name below
|
|
- name: nfs
|
|
mountPath: "/usr/share/nginx/html"
|
|
volumes:
|
|
- name: nfs
|
|
persistentVolumeClaim:
|
|
claimName: nfs
|