Slide 1

Slide 1 text

Flocker Kubernetes volume plugins @agonzalezro richd77@flickr

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

TOC 1. Introduction to Flocker 2. Introduction to Kubernetes 3. Introduction to Flocker plugin 4. Code 5. Summary

Slide 4

Slide 4 text

What Flocker offers? container Container data data

Slide 5

Slide 5 text

What else does it offer? • AWS EBSRackspace Cloud Block Storage • Anything that supports the OpenStack Cinder API • EMC ScaleIO • EMC XtremIO • Local storage using our ZFS driver (currently Experimental)

Slide 6

Slide 6 text

Flocker Docker plugin HTTP Rest API with twisted

Slide 7

Slide 7 text

Docker plugins /VolumeDriver.Create
 /VolumeDriver.Mount
 /VolumeDriver.Path
 /VolumeDriver.Unmount
 /VolumeDriver.Remove

Slide 8

Slide 8 text

Izabella.R@flickr

Slide 9

Slide 9 text

k8s architecture Kubernetes master Replication controllers Node #1 Container #1 Container #2 … Container #1 Container #2 … Kubelet Docker daemon Node #2 …

Slide 10

Slide 10 text

How does Flocker fit in? Kubernetes master Replication controllers Node #1 Container/s Container/s Flocker Agents Kubelet Flocker Control Service Storage backend Docker daemon

Slide 11

Slide 11 text

How to use it (1/2): Create volume with the flocker-cli: $ uft-flocker-volumes \
 --control-service=172.16.255.250
 create --node=43a06d55 \
 -m name=my-flocker-vol -s 10G $ uft-flocker-volumes \
 --control-service=172.16.255.250
 list-nodes

Slide 12

Slide 12 text

How to use it (2/2): spec:
 containers:
 - name: web
 image: nginx
 ports:
 - name: web
 containerPort: 80
 volumeMounts:
 - name: www-root
 mountPath: "/usr/share/nginx/html"
 volumes:
 - name: www-root
 flocker:
 datasetName: my-flocker-vol

Slide 13

Slide 13 text

mike_elleray@flickr

Slide 14

Slide 14 text

Before going to code! Volume vs PersistentVolume Examples: gcePersistentDisk, awsElasticBlockStore, gitRepo (cool example!), etc…

Slide 15

Slide 15 text

How was it made? bit.ly/k8smeetup

Slide 16

Slide 16 text

API: pkg/api/{,v1/}types.go type VolumeSource struct {
 Flocker *FlockerVolumeSource `json:"flocker,omitempty"`
 …
 } type PersistentVolumeSource struct {
 Flocker *FlockerVolumeSource `json:"flocker,omitempty"`
 …
 } type FlockerVolumeSource struct {
 // Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker
 DatasetName string `json:"datasetName"`
 }

Slide 17

Slide 17 text

VolumePlugin interface type VolumePlugin interface {
 Init(host VolumeHost)
 Name() string
 CanSupport(spec *Spec) bool
 NewBuilder(
 s *Spec, pod *api.Pod, opts VolumeOptions
 ) (Builder, error)
 NewCleaner(
 name string, podUID types.UID
 ) (Cleaner, error)
 } https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/plugins.go#L55-L81

Slide 18

Slide 18 text

How was it used for Flocker? NewBuilder
 just creates the struct that will allow us to setup the datasets NewCleaner
 doing nothing

Slide 19

Slide 19 text

Builder interface type Builder interface {
 Volume // gives GetPath()
 SetUp() error
 SetUpAt(dir string) error
 IsReadOnly() bool
 } https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/volume.go#L34-L48

Slide 20

Slide 20 text

How was it used for Flocker? Setup -> Calls SetUpAt the datasetName received by API get dataset check primary node update it ok error not there match sync

Slide 21

Slide 21 text

beargarebear@reddit

Slide 22

Slide 22 text

Things that didn’t go well • OMG, CLAs! Sorry Matt! • Shippable and Jenkins • Creating the volume on SetUp • hack/ scripts

Slide 23

Slide 23 text

Future! • 1.2 has: CreatableVolumePlugin • Run Flocker in a Pod • Probably use VolumeConfig

Slide 24

Slide 24 text

What did we talk about? 1. Flocker & Kubernetes 2. Plugin for Flocker 3. Something you have seen in the code

Slide 25

Slide 25 text

Thanks! @agonzalezro richd77@flickr