Projects:Kubernetes: verschil tussen versies

Naar navigatie springen Naar zoeken springen
195 bytes toegevoegd ,  27 mrt 2019
Regel 438: Regel 438:


Now that we know how to persistently store data and access it from Pods, it's time to create an actual Deployment with a real-world application in it.
Now that we know how to persistently store data and access it from Pods, it's time to create an actual Deployment with a real-world application in it.
For this, I use the following tutorial: https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/ - binding /persistent/html to /usr/share/nginx/html inside the containers:


<pre>
<pre>
$ cat nginx.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-html-storage
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  nfs:
    path: /persistent/html
    server: <IP of nfs server>
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nginx-webfiles
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
apiVersion: apps/v1
kind: Deployment
kind: Deployment
Regel 457: Regel 480:
     spec:
     spec:
       volumes:
       volumes:
       - name: websource
       - name: webfiles
         nfs:
         persistentVolumeClaim:
           path: /persistent/html
           claimName: nginx-webfiles
          server: <ipaddress>
       containers:
       containers:
       - name: nginx
       - name: nginx
Regel 468: Regel 490:
         volumeMounts:
         volumeMounts:
         - mountPath: /usr/share/nginx/html
         - mountPath: /usr/share/nginx/html
           name: websource
           name: webfiles
</pre>
</pre>


Regel 477: Regel 499:
</pre>
</pre>


Then, start the deployment:
Then, start the PV, PVC and deployment:


<pre>
<pre>

Navigatiemenu