mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Merge pull request #9636 from caesarxuchao/nfs-examples-v1
update examples/nfs to v1
This commit is contained in:
commit
4797230284
@ -8,6 +8,19 @@ in a pod.
|
|||||||
The example below shows how to export a NFS share from a pod and import it
|
The example below shows how to export a NFS share from a pod and import it
|
||||||
into another one.
|
into another one.
|
||||||
|
|
||||||
|
###Prerequisites
|
||||||
|
The nfs server pod creates a privileged container, so if you are using a Salt based KUBERNETES_PROVIDER (**gce**, **vagrant**, **aws**), you have to enable the ability to create privileged containers by API.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#At the root of Kubernetes source code
|
||||||
|
$ vi cluster/saltbase/pillar/privilege.sls
|
||||||
|
|
||||||
|
# If true, allow privileged containers to be created by API
|
||||||
|
allow_privileged: true
|
||||||
|
```
|
||||||
|
|
||||||
|
Rebuild the Kubernetes and spin up a cluster using your preferred KUBERNETES_PROVIDER.
|
||||||
|
|
||||||
### NFS server part
|
### NFS server part
|
||||||
|
|
||||||
Define [NFS server pod](nfs-server-pod.yaml) and
|
Define [NFS server pod](nfs-server-pod.yaml) and
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: nfs-server
|
name: nfs-server
|
||||||
@ -8,8 +8,8 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: nfs-server
|
- name: nfs-server
|
||||||
image: jsafrane/nfs-data
|
image: jsafrane/nfs-data
|
||||||
privileged: true
|
|
||||||
ports:
|
ports:
|
||||||
- name: nfs
|
- name: nfs
|
||||||
containerPort: 2049
|
containerPort: 2049
|
||||||
protocol: tcp
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
kind: Service
|
kind: Service
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
metadata:
|
metadata:
|
||||||
name: nfs-server
|
name: nfs-server
|
||||||
spec:
|
spec:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# This pod imports nfs-server.default.kube.local:/ into /var/www/html
|
# This pod imports nfs-server.default.kube.local:/ into /var/www/html
|
||||||
#
|
#
|
||||||
|
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: nfs-web
|
name: nfs-web
|
||||||
@ -13,7 +13,6 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- name: web
|
- name: web
|
||||||
containerPort: 80
|
containerPort: 80
|
||||||
protocol: tcp
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
# name must match the volume name below
|
# name must match the volume name below
|
||||||
- name: nfs
|
- name: nfs
|
||||||
@ -24,4 +23,3 @@ spec:
|
|||||||
# FIXME: use the right hostname
|
# FIXME: use the right hostname
|
||||||
server: nfs-server.default.kube.local
|
server: nfs-server.default.kube.local
|
||||||
path: "/"
|
path: "/"
|
||||||
readOnly: false
|
|
||||||
|
Loading…
Reference in New Issue
Block a user