Projects:Kubernetes: verschil tussen versies

Naar navigatie springen Naar zoeken springen
985 bytes toegevoegd ,  27 mrt 2019
Regel 359: Regel 359:
</pre>
</pre>


As you see, the <code>nginx-webfiles</code> PVC is created, but is Pending, because haven't supplied any PersistentVolumes to the cluster yet that can fulfill it.
As you see, the <code>nginx-webfiles</code> PVC is created, but is Pending, because haven't supplied any PersistentVolumes to the cluster yet that can fulfill it. So, we create a PersistentVolume:
 
<pre>
$ cat nfs-storage.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-storage
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  nfs:
    path: /persistent/html
    server: <IP address>
$ kubectl apply -f nfs-storage.yaml
$ kubectl get pv       
NAME          CAPACITY  ACCESS MODES  RECLAIM POLICY  STATUS  CLAIM                    STORAGECLASS  REASON  AGE
nfs-storage  10Gi      RWO            Retain          Bound    default/nginx-webfiles                          18s
</pre>
 
It might take a moment for the PVC to be bound, but sure enough, after a bit, it is:
 
<pre>
$ kubectl get pvc
NAME            STATUS  VOLUME        CAPACITY  ACCESS MODES  STORAGECLASS  AGE
nginx-webfiles  Bound    nfs-storage  10Gi      RWO                          3m15s
</pre>
 
Note that we asked for only 2 GB, but since the volume provides 10 GB, we got the lowest capacity volume that could be bound.


== Running a Deployment using this volume ==
== Running a Deployment using this volume ==

Navigatiemenu