Projects:Kubernetes: verschil tussen versies

Naar navigatie springen Naar zoeken springen
1.279 bytes toegevoegd ,  15 mrt 2019
Geen bewerkingssamenvatting
Regel 319: Regel 319:
145.131.6.179:/persistent on /foo type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=145.131.6.179,local_lock=none,addr=145.131.6.179)
145.131.6.179:/persistent on /foo type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=145.131.6.179,local_lock=none,addr=145.131.6.179)
</pre>
</pre>
== Running a Deployment using this volume ==
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>
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      volumes:
      - name: websource
        nfs:
          path: /persistent/html
          server: <ipaddress>
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: websource
</pre>
Now, before starting this deployment, make an example web page by creating <code>/persistent/html/index.html</code> with something like:
<pre>
<nowiki><h1>It's working!</h1></nowiki>
</pre>
Then, start the deployment:
<pre>
$ kubectl apply -f nginx.yaml
</pre>
TODO: explain difference between apply and create
TODO: explain port-forward


= Creating your own pods =
= Creating your own pods =

Navigatiemenu