...
In this example will walk through creating a NFS server instance, that exports storage that is backed by the default StorageClass for SC for the environment you happen to be running in. In some environments, this could be a host path hostPath, in others it could be a cloud provider virtual disk. Either way, this example requires a default StorageClass to SC to exist.
So let's create a simple StorageClass (remember to activate the plugin --enable-admission-plugins=DefaultStorageClass in kube-apiserver.yaml), which will act as the default
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer |
Next we create a "large" PV, of type hostPath, based on the default SC
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
apiVersion: v1
kind: PersistentVolume
metadata:
name: local-pv
labels:
type: local
spec:
storageClassName: local-storage
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data" |
Create and Initialize NFS Server
...