There is an ongoing transition in server-side infrastructure as successive technology layers emerge, evolve and mature. This talk introduces the architecture and features of Kubernetes and describes how Kubernetes is the natural “next step” in this changing landscape. We look at the new challenges in a world where the building blocks are “applications” rather than “servers” and finish with a glimpse into future function-centric serverless frameworks.
7. The Server-Side Software Stack
Your Code
Framework
Language
Software Distribution
OS/Kernel
CPU
Physical Enclosure
Electricity/Cooling
Boring infrastructure
Interesting 3rd-party
choices
Your actual problem
Somewhere here
8. Introducing Kubernetes
• Cluster orchestrator/manager
• Often abbreviated to “k8s”
• Runs jobs in containers (usually Docker images) - no VM overhead
• Originally created/released by Google based on internal experience
• Vibrant Free Software project (Apache2 license)
• Application-centric focus
9. Application-centric
You tell Kubernetes:
• Application executable, required libraries (as a docker image)
• Command line arguments, environment variables
• Config files
• Application health checks
• (Optionally) memory/cpu requirements, scheduling hints
... and Kubernetes does everything else
10. … with Kubernetes + Docker
Your Code
Framework
Language
Software Distribution
OS/Kernel
CPU
Physical Enclosure
Electricity/Cooling
Boring infrastructure
Interesting 3rd-party
choices
Your actual problem
Somewhere here
11. Application-Centric Computing
Before: After Kubernetes+Docker:
✓ Where to run
✓ How to run
✓ How to upgrade
✓ Recovering from failures
Interesting: Orchestration
Boring: Hardware
Interesting: Applications
Boring: Everything else
14. Declarative Configuration
• Say what not how
• Install/upgrade/downgrade is
all derived from single config
• Allows for strong tooling
ecosystem
• No mention of host details,
VMs, network topology, etc
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
ports:
- containerPort: 80
15. Building Blocks
Most common:
• Pod - group of containers that always run together
• Deployment - describes a number of replicas of a pod
• Service - exposes several pods as a single load-balanced entity
• PersistentVolume - abstraction over network attached storage
• ConfigMap - configuration made available to pods
• Secret - like ConfigMap, but assumed to contain sensitive material
17. … with Kubernetes + Docker
Your Code
Framework
Language
Software Distribution
OS/Kernel
CPU
Physical Enclosure
Electricity/Cooling
Boring infrastructure
Interesting 3rd-party
choices
Your actual problem
Somewhere here
18. Functions aim to be general purpose infrastructure, unlike PaaS.
Functions raise the level of “boring”, into your application.
#!Boring
boring(boring)
boring
# Boring boring
boring boring(boring):
--> Your code goes here <--
Boring(boring) -> boring;
boring {{boring.boring}}
Next? Functions as a Service
19. Highlight: Kubeless
• Kubernetes native - designed specifically for Kubernetes
• Simple - reuses existing Kubernetes pieces wherever possible
• Node.js, Python, Ruby and more on the way
• Open Source project, led by Bitnami
• Get prometheus metrics, error handling, etc for free from runtime,
you just provide the “do work” function
20. Example: Automatic Thumbnail Creation
#!python
# (Some imports and global variable declarations elided)
def thumbnail(context):
bucket = os.path.dirname(context['Key'])
_, file_extension = os.path.splitext(context['Key'])
filename = os.path.basename(context['Key'])
if file_extension.upper() != ".JPEG":
return "Not a picture"
if context['EventType'] == "s3:ObjectCreated:Put" and bucket == 'foobar':
tf = tempfile.NamedTemporaryFile()
tf_thumb = tempfile.NamedTemporaryFile()
client.fget_object(bucket, filename, tf.name)
img = Image.open(tf.name)
img.thumbnail((120,120))
img.save(tf_thumb.name, "JPEG")
# puts the thumbnail in a thumbnail bucket
client.fput_object('thumb', thumb_name = filename + '.thumb', tf_thumb.name)
return "Thumbnail creation triggered"