@saturnism @googlecloud @kubernetesio @jfokus Challenges Which host machine(s) should each service run on? Avoid port conflicts? How does the application code find the Guest Book service? How do we keep all of these service running? What happens if a host machine has trouble? Are the services healthy? How do we scale when load changes? Run this in another environment? QA, dev, another cloud, your servers?
@saturnism @googlecloud @kubernetesio @jfokus Old Way: Shared machines kernel libs app app app No isolation No namespacing Common libs Highly coupled apps and OS app
@saturnism @googlecloud @kubernetesio @jfokus Old Way: Virtual machines Some isolation Expensive and inefficient Still highly coupled to the guest OS Hard to manage app libs kernel libs app app kernel app libs libs kernel kernel
@saturnism @googlecloud @kubernetesio @jfokus Don’t Log to Container Filesystem! Log to a volume… docker -v /tmp/log:/log Or Send it elsewhere! STDOUT is captured by Docker / Kubernetes
@saturnism @googlecloud @kubernetesio @jfokus job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } replicas = 5 // Number of tasks } 10000
@saturnism @googlecloud @kubernetesio @jfokus web browsers BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard Scheduler borgcfg web browsers scheduler Borglet Borglet Borglet Borglet Config file BorgMaster link shard UI shard persistent store (Paxos) Binary What just happened?
@saturnism @googlecloud #kubernetes #devoxx Kubernetes Greek for “Helmsman”; also the root of the words “governor” and “cybernetic” • Infrastructure for containers • Schedules, runs, and manages containers on virtual and physical machines • Platform for automating deployment, scaling, and operations • Inspired and informed by Google’s experiences and internal systems • 100% Open source, written in Go
@saturnism @googlecloud @kubernetesio @jfokus Before Stateful Set - Stateless Cattles Deployment Replicas → 1 Pod frontend Pod - cb-axk3u type = Couchbase version = 1.0 Pod CB-Disk Volume Mount
@saturnism @googlecloud @kubernetesio @jfokus Before Pet Set - Stateless Cattles Deployment Replicas → 2 Pod frontend Pod - cb-axk3u type = Couchbase version = 1.0 Pod CB-Disk Pod frontend Pod - cb-a94kd type = Couchbase version = 1.0 Volume Mount
@saturnism @googlecloud @kubernetesio @jfokus Stateful Set Stateful Set Replicas → 1 Pod frontend Pod - cb-0 type = Couchbase version = 1.0 cb-0 Volume Mount Automatic Provisioning
@saturnism @googlecloud @kubernetesio @jfokus Stateful Set Stateful Set Replicas → 2 Pod frontend Pod - cb-0 type = Couchbase version = 1.0 Pod Pod frontend Pod - cb-1 type = Couchbase version = 1.0 cb-0 Volume Mount cb-1 Volume Mount
@saturnism @googlecloud @kubernetesio @jfokus Stateful Set Stateful Set Replicas → 2 Pod frontend Pod - cb-0 type = Couchbase version = 1.0 Pod Pod frontend Pod - cb-1 type = Couchbase version = 1.0 cb-0 Volume Mount Automatic Provisioning cb-1 Volume Mount
@saturnism @googlecloud @kubernetesio @jfokus Geographically aware DNS gets clients to the "closest" healthy cluster. Standard Kubernetes service load balancing within each cluster. Can be extended to divert traffic away from "healthy-but-saturated" clusters. Cross-cluster Load Balancing
@saturnism @googlecloud @kubernetesio @jfokus Location affinity continued... Negative Affinity • Don't run my replicas in the same failure domain (host/rack/zone) Topology • Same host • Same rack • Same zone • Same metro region • Same sub-continent Absolute affinity
@saturnism @googlecloud @kubernetesio @jfokus What can we federate? As of Kubernetes 1.5 Namespace Deployment Replica Set Secret ConfigMap Service Ingress
@saturnism @googlecloud @kubernetesio @jfokus Federation Control Plane Cluster 2 us-central1-b Cluster 1 us-east1-b Cluster 3 europe-west1-b Cluster 4 asia-east1-b API API API API Cluster 2 - us-central1-b Federation API Server Federation Controller Federation Key/value store (etcd) Federation API contexts: - context: cluster: federation-cluster user: federation-cluster