persistent storage with containers with kubernetes & openshift

22
Persistent Storage w/ Kubernetes & OpenShift © 2015 Mark Turansky - [email protected]

Upload: red-hat-events

Post on 15-Apr-2017

2.154 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Persistent Storage with Containers with Kubernetes & OpenShift

Persistent Storagew/ Kubernetes & OpenShift

© 2015

Mark Turansky - [email protected]

Page 2: Persistent Storage with Containers with Kubernetes & OpenShift

Red Hat and KubeStuff we’ve built● Storage● Secrets● Quotas ● Limit Ranges● Deployments● … and more

Stuff we contribute to● lots of API server● Networking● Auth & Authz● Security contexts● Scalability● … and more

Page 3: Persistent Storage with Containers with Kubernetes & OpenShift

OpenShift and KubeStuff we add around Kube● Automatic Builds & Deployments● Application Templates● STI (Source-to-image) builder● Tons of RH approved/tested images● Red Hat’s standard of excellence and support for

open source technology

Page 4: Persistent Storage with Containers with Kubernetes & OpenShift

Managing compute != managing storage

Page 5: Persistent Storage with Containers with Kubernetes & OpenShift

Pets vs. Cattle

Pets● Have names and identity● You care about them● You nurse them back to

health when sick

Cattle● Have numbers● Are just like other cattle● You don’t care about them● You get a new ones

Page 6: Persistent Storage with Containers with Kubernetes & OpenShift

Persistent StorageGoals● Allow admins to describe storage● Allow users to request storage● No tight coupling to any disk, server, network,

or storage device

Page 7: Persistent Storage with Containers with Kubernetes & OpenShift

Two API objects

PersistentVolume (PV)

PersistentVolumeClaim (PVC)

Page 8: Persistent Storage with Containers with Kubernetes & OpenShift

PersistentVolume● A PV is a real piece of networked storage in the cluster

provisioned by an administrator.● PVs are resources like nodes are resources● Long lifecycle independent of any pod

Page 9: Persistent Storage with Containers with Kubernetes & OpenShift

Persistent VolumeapiVersion: v1

kind: PersistentVolume

metadata:

name: pv0003

spec:

capacity:

storage: 5Gi

accessModes:

- ReadWriteOnce

persistentVolumeReclaimPolicy: Recycle nfs:

path: /tmp

server: 172.17.0.2

Page 10: Persistent Storage with Containers with Kubernetes & OpenShift

Persistent Volume Claim● A request for storage by a user● Allows specific resource requests (e.g, size, access modes)● Used like a claim check

Page 11: Persistent Storage with Containers with Kubernetes & OpenShift

Persistent Volume Claimkind: PersistentVolumeClaim

apiVersion: v1

metadata: name: myclaim

spec: accessModes: - ReadWriteOnce

resources: requests: storage: 3Gi

Page 12: Persistent Storage with Containers with Kubernetes & OpenShift

Storage Lifecycle● Provisioning● Binding● Using● Releasing● Reclaiming

Page 13: Persistent Storage with Containers with Kubernetes & OpenShift

Provisioning● Dynamic● Scripted● Manual

Page 14: Persistent Storage with Containers with Kubernetes & OpenShift

Binding● Claims matched to volumes● Always more, never less● Claim can be unbound indefinitely

Page 15: Persistent Storage with Containers with Kubernetes & OpenShift

Using a claim checkkind: PodapiVersion: v1metadata: name: mypod labels: name: frontendhttpspec: containers: - name: myfrontend image: nginx ports: - containerPort: 80 name: "http-server" volumeMounts: - mountPath: "/var/www/html" name: mypd volumes: - name: mypd persistentVolumeClaim: claimName: myclaim

* Claims and Pods must be in the same namespace!

Page 16: Persistent Storage with Containers with Kubernetes & OpenShift

Re-use your claim

$ oc delete pod mypod

● Deleting a pod does not delete your claim● Re-use your claim in another pod

Page 17: Persistent Storage with Containers with Kubernetes & OpenShift

Releasing

$ oc delete pvc myclaim● Delete your claim to release your storage● Volume is “released” but not available for another claim● Recycling policy can scrub the volume to clean previous

claimant’s data

Page 18: Persistent Storage with Containers with Kubernetes & OpenShift

Reclaiming

● Reclaim policy per volume● Scrubbing is configurable (PR #9870)● Delete/Recreate via dynamic provisioning● PVs are “Retain” by default and can be manually reclaimed

Page 19: Persistent Storage with Containers with Kubernetes & OpenShift

Types of persistent volumes● GCEPersistentDisk● AWSElasticBlockStore● NFS● Glusterfs● iSCSI● RBD (Ceph block device)

● HostPath (for testing)● Fiber Channel● Cephfs● Cinder & Manila

Page 20: Persistent Storage with Containers with Kubernetes & OpenShift

Demo!Wordpress + MySQLBoth require persistent storage

https://github.com/openshift/origin/tree/master/examples/wordpress

Page 21: Persistent Storage with Containers with Kubernetes & OpenShift

Roadmap● Robust security between pods, volumes, and containers● Scalable storage and nominal services● Dynamic provisioning

Page 22: Persistent Storage with Containers with Kubernetes & OpenShift

https://github.com/openshift/origin

Red Hat & Project Atomic swag and raffles and smart people

Booth #310

github: markturansky

irc: markturansky

#openshift-dev

#google-containers