Skip to content

Instantly share code, notes, and snippets.

@rootfs
Last active January 14, 2016 19:25
Show Gist options
  • Save rootfs/2232f99e51896821de54 to your computer and use it in GitHub Desktop.
Save rootfs/2232f99e51896821de54 to your computer and use it in GitHub Desktop.
kubernetes code walkthrough

Cloud provider

Cloud provider is the abstraction of Cloud operations including:

// Interface is an abstract, pluggable interface for cloud providers.
type Interface interface {
	// LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
	LoadBalancer() (LoadBalancer, bool)
	// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
	Instances() (Instances, bool)
	// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
	Zones() (Zones, bool)
	// Clusters returns a clusters interface.  Also returns true if the interface is supported, false otherwise.
	Clusters() (Clusters, bool)
	// Routes returns a routes interface along with whether the interface is supported.
	Routes() (Routes, bool)
	// ProviderName returns the cloud provider ID.
	ProviderName() string
	// ScrubDNS provides an opportunity for cloud-provider-specific code to process DNS settings for pods.
	ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)
}

Currently the supported Cloud providers are AWS, GCE, Mesos, OpenStack, Rackspace, and oVirt (incompleted operations).

Once a Cloud provider is available, a VM instance can attach to the Cloud's block storage by getting Cloud volume class and calling volume specific Attach.

Volume Plugins

Volume Plugins is the abstraction to create, mount, destroy volumes. A (incomplete) list of supported volume types can be found here.

When Kubernetes creates a Pod, the Pod that wants to have external storage can either provides a volume source specification or a Persistent Volume Claim.

File VS. Block Storage

While Kubernetes can either use POSIX file storage (e.g. local storage, NFS, SMB) or make a filesystem (i.e. ext4 or xfs) on block store (i.e. AWS EBS, GCE PD, iSCSI, Ceph RBD, and potentially Azure Blob VHD), experiences show block storage is more favorable than file storage, for ease of deployment, security, and performance on many types of workload. Dynamically provisioning a Cloud block store on Kubernetes requires Kubernetes able to access Cloud providers and their APIs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment