Ingredients for micro-
services based platform
for cloud native computing
craigmcl@google.com
Towards cloud native computing
Container Packaged
Dynamically Scheduled
Microservices Oriented
Towards cloud native computing
Container Packaged
Dynamically Scheduled
Microservices Oriented
Not just Google ...
… n other internet companies
context
posit that “cloud native” is three things
1. container packaged
2. dynamically scheduled
3. micro-services oriented
micro-services
• lets developers assemble small, independently deployable components
• create loosely coupled, more agile systems
• a basic atom of consumption for software
• a basic atom of management for software
why?
Loosely coupled = easier to build and extend
• Compose applications from micro-services
• Mix in and extend third party services
• More agile systems and teams
why?
Separation of concerns = specialization
• Separate infrastructure ops from cluster ops from app ops
• Radically increase code reuse
• Radically reduced operations overhead
why?
Deeper automation = fewer bad outcomes
• Higher abstraction provides more insight into behavior
• Orchestration made far easier
• Self-healing and self-managing systems
Greek for “Helmsman”; also the root of the word
“Governor”, “Cybernetics’
• Container orchestrator
• Runs Docker containers
• Supports multiple cloud and bare-metal
environments
• Inspired and informed by Google’s experiences
and internal systems
• Open source, written in Go
Manage services, not machines
Kubernetes
libs
app
kernel
libs
app
libs
app
libs
app
libs
app
kernel
libs
app
libs
app
libs
app
Kubernetes Master
libs
app
kernel
libs
app
libs
app
libs
app
Kubernetes gives you a cluster
Pod
Labels
Replication Controller
Service
Kubernetes Core Concepts
Group of containers
Live and die together
Shared network interface
Pod
Serving app
Data updater
Log collector
Pod
Label anything
Name-value pair
Make your own
Grouping via label selector
Pod
App
Log Collector
...
type = Frontend
version = 1.0
Labels
Replication
Controller
Replicas → 2
Pod
App
Log Collector
...
type = Frontend
version = 1.0
Pod
App
Log Collector
...
type = Frontend
version = 1.0
Replication Controller
Replication
Controller
Replicas → 1
Pod
App
Log Collector
...
type = Frontend
version = 1.0
Pod
App
Log Collector
...
type = Frontend
version = 1.0
Replication Controller
Replication
Controller
Replicas → 2
Pod
frontend
Pod
type = Frontend
version = 1.0
Pod
type = Frontend
version = 1.0
Service
Label selectors:
version = 1.0
type = Frontend
(micro) Service
Pods are ephemeral
● Need something addressable that is not
How do one set of ephemeral things find another set?
● Discoverable through DNS
● Discoverable environment variables
In time can do fancy things
● Dynamic activation, context based scheduling, etc
Micro-services are a gateway to agile apps
Offers a minimum atom of software consumption
● Minimally (hostname, port)
● Endpoint API (enumerate membership; watch for changes)
● Relies on a label selector to establish service membership
Offers a simple framework for orchestration
● Route based on a label selector
● Blue/Green
● Canary deployment
● ...
Kubernetes Services Defined
Service Scoping
Two basic scope levels
● Cluster
● Namespace
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "my-service"
},
"spec": {
"selector": {
"app": "MyApp"
},
"ports": [
{
"protocol": "TCP",
"port": 80,
"targetPort": 9376
}
]
}
}
Creating a Service
Assumes a set of pods listening
on port 9376, with label ‘MyApp’
set.
POST to the API server will
create a new service object
Finding your service: Environment variables
Automatically adds environment variables that are available to each
container
REDIS_MASTER_SERVICE_HOST=10.0.0.11
REDIS_MASTER_SERVICE_PORT=6379
REDIS_MASTER_PORT=tcp://10.0.0.11:6379
REDIS_MASTER_PORT_6379_TCP=tcp://10.0.0.11:6379
REDIS_MASTER_PORT_6379_TCP_PROTO=tcp
REDIS_MASTER_PORT_6379_TCP_PORT=6379
REDIS_MASTER_PORT_6379_TCP_ADDR=10.0.0.11
Finding your service: DNS
An optional capability is DNS support (offered as a cluster add-on)
Server watches Kubernetes Services API and automatically creates
DNS records for services
Use DNS Lookup with <service-name>.<namespace> to resolve IP
Services in the same namespace can be found via <service-name>
Broadening the Service definition: External services
VM LB IP:Port
VM IP:Port
K8s
Pod
Other clouds/
On-prem IP:Port
Multiple Producers You may want to ‘mix in’ other
services (VM based/SaaS based)
Ideally consume them as if they
were ‘native’ to your cluster
To support this, it is possible to
create services without
specifying a selector
Towards a cluster environment
● A critical step towards ‘cloud native development’
● Brings a new ‘type B’ cloud
○ Run it natively
○ Overlay it on your ‘type A’ cloud infrastructure
Towards standards: CNCF
compute node
OS
out of scope
api specification
reference
implementation
container
runtime
infrastructure provisioning
agent
OCI reference
implementation
OCI api
specification
…. N
distributed systems services
resource scheduling
application definition and orchestration
software defined network software defined storage
container image repository
container image registry
Distributed systems services
compute node
OS
container
runtime
infrastructure provisioning
agent
…. N
resource scheduling
application definition and orchestration
software defined network software defined storage
container repository
container registry
distributed systems services
● a standard set of services that are not bound to a single node
○ supporting application use cases
■ naming/discovery
■ locking/quorum
■ state management/sharding
■ logging/monitoring
○ supporting cluster use cases
■ distributed state management
■ distributed control plane
■ logging/auditing
● a minimum atom of consumption for software
○ within the cluster
○ between clusters
○ from outside the cluster
Learn more.
Talk to me...
Twitter: @cmcluck
Email me: craigmcl@google.com
Follow Kubernetes…
Twitter: @kubernetesio
Github: https://github.com/googlecloudplatform/kubernetes
Blog: http://blog.kubernetes.io/

Micro-services meetup

  • 1.
    Ingredients for micro- servicesbased platform for cloud native computing craigmcl@google.com
  • 2.
    Towards cloud nativecomputing Container Packaged Dynamically Scheduled Microservices Oriented
  • 3.
    Towards cloud nativecomputing Container Packaged Dynamically Scheduled Microservices Oriented Not just Google ... … n other internet companies
  • 4.
    context posit that “cloudnative” is three things 1. container packaged 2. dynamically scheduled 3. micro-services oriented micro-services • lets developers assemble small, independently deployable components • create loosely coupled, more agile systems • a basic atom of consumption for software • a basic atom of management for software
  • 5.
    why? Loosely coupled =easier to build and extend • Compose applications from micro-services • Mix in and extend third party services • More agile systems and teams
  • 6.
    why? Separation of concerns= specialization • Separate infrastructure ops from cluster ops from app ops • Radically increase code reuse • Radically reduced operations overhead
  • 7.
    why? Deeper automation =fewer bad outcomes • Higher abstraction provides more insight into behavior • Orchestration made far easier • Self-healing and self-managing systems
  • 8.
    Greek for “Helmsman”;also the root of the word “Governor”, “Cybernetics’ • Container orchestrator • Runs Docker containers • Supports multiple cloud and bare-metal environments • Inspired and informed by Google’s experiences and internal systems • Open source, written in Go Manage services, not machines Kubernetes
  • 9.
  • 10.
  • 11.
    Group of containers Liveand die together Shared network interface Pod Serving app Data updater Log collector Pod
  • 12.
    Label anything Name-value pair Makeyour own Grouping via label selector Pod App Log Collector ... type = Frontend version = 1.0 Labels
  • 13.
    Replication Controller Replicas → 2 Pod App LogCollector ... type = Frontend version = 1.0 Pod App Log Collector ... type = Frontend version = 1.0 Replication Controller
  • 14.
    Replication Controller Replicas → 1 Pod App LogCollector ... type = Frontend version = 1.0 Pod App Log Collector ... type = Frontend version = 1.0 Replication Controller
  • 15.
    Replication Controller Replicas → 2 Pod frontend Pod type= Frontend version = 1.0 Pod type = Frontend version = 1.0 Service Label selectors: version = 1.0 type = Frontend (micro) Service
  • 16.
    Pods are ephemeral ●Need something addressable that is not How do one set of ephemeral things find another set? ● Discoverable through DNS ● Discoverable environment variables In time can do fancy things ● Dynamic activation, context based scheduling, etc Micro-services are a gateway to agile apps
  • 17.
    Offers a minimumatom of software consumption ● Minimally (hostname, port) ● Endpoint API (enumerate membership; watch for changes) ● Relies on a label selector to establish service membership Offers a simple framework for orchestration ● Route based on a label selector ● Blue/Green ● Canary deployment ● ... Kubernetes Services Defined
  • 18.
    Service Scoping Two basicscope levels ● Cluster ● Namespace
  • 19.
    { "kind": "Service", "apiVersion": "v1", "metadata":{ "name": "my-service" }, "spec": { "selector": { "app": "MyApp" }, "ports": [ { "protocol": "TCP", "port": 80, "targetPort": 9376 } ] } } Creating a Service Assumes a set of pods listening on port 9376, with label ‘MyApp’ set. POST to the API server will create a new service object
  • 20.
    Finding your service:Environment variables Automatically adds environment variables that are available to each container REDIS_MASTER_SERVICE_HOST=10.0.0.11 REDIS_MASTER_SERVICE_PORT=6379 REDIS_MASTER_PORT=tcp://10.0.0.11:6379 REDIS_MASTER_PORT_6379_TCP=tcp://10.0.0.11:6379 REDIS_MASTER_PORT_6379_TCP_PROTO=tcp REDIS_MASTER_PORT_6379_TCP_PORT=6379 REDIS_MASTER_PORT_6379_TCP_ADDR=10.0.0.11
  • 21.
    Finding your service:DNS An optional capability is DNS support (offered as a cluster add-on) Server watches Kubernetes Services API and automatically creates DNS records for services Use DNS Lookup with <service-name>.<namespace> to resolve IP Services in the same namespace can be found via <service-name>
  • 22.
    Broadening the Servicedefinition: External services VM LB IP:Port VM IP:Port K8s Pod Other clouds/ On-prem IP:Port Multiple Producers You may want to ‘mix in’ other services (VM based/SaaS based) Ideally consume them as if they were ‘native’ to your cluster To support this, it is possible to create services without specifying a selector
  • 23.
    Towards a clusterenvironment ● A critical step towards ‘cloud native development’ ● Brings a new ‘type B’ cloud ○ Run it natively ○ Overlay it on your ‘type A’ cloud infrastructure
  • 24.
    Towards standards: CNCF computenode OS out of scope api specification reference implementation container runtime infrastructure provisioning agent OCI reference implementation OCI api specification …. N distributed systems services resource scheduling application definition and orchestration software defined network software defined storage container image repository container image registry
  • 25.
    Distributed systems services computenode OS container runtime infrastructure provisioning agent …. N resource scheduling application definition and orchestration software defined network software defined storage container repository container registry distributed systems services ● a standard set of services that are not bound to a single node ○ supporting application use cases ■ naming/discovery ■ locking/quorum ■ state management/sharding ■ logging/monitoring ○ supporting cluster use cases ■ distributed state management ■ distributed control plane ■ logging/auditing ● a minimum atom of consumption for software ○ within the cluster ○ between clusters ○ from outside the cluster
  • 26.
    Learn more. Talk tome... Twitter: @cmcluck Email me: craigmcl@google.com Follow Kubernetes… Twitter: @kubernetesio Github: https://github.com/googlecloudplatform/kubernetes Blog: http://blog.kubernetes.io/