© Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0
Communication Amongst
Microservices:
Kubernetes, Istio, and Spring Cloud
Angela Chin, Senior Software Engineer, Pivotal
Twitter: @AngelaSChin
I’m Angela and I love
● (Software) Networking
● Hot yoga
● Hiking
● Desserts
● Food
Thanks for joining me.
Let’s get started!
Confidential
What is Kubernetes?
Confidential
k8s!
Confidential
What is k8s?
Confidential
Shorthand for Kubernetes!
Confidential
Confidential
Kubernetes
● Container orchestrator built around Docker
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
● Dev env == production env
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
● Dev env == production env
● Multi-cloud
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
● Dev env == production env
● Multi-cloud
● Community convergence & 3rd party integrations
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
● Dev env == production env
● Multi-cloud
● Community convergence & 3rd party integrations
● Flexibility
Confidential
Kubernetes
● Runs applications
● Reduces infrastructure code
● Reduces toil
Confidential
Confidential
Pivotal Container Service (PKS)
Confidential
PKS
● Managed Kubernetes for multiple clusters
Confidential
PKS
● Managed Kubernetes for multiple clusters
Confidential
PKS
● Managed Kubernetes for multiple clusters
Confidential
PKS
● Managed Kubernetes for multiple clusters
● Focused on Day 2 Operations
Confidential
PKS
● Managed Kubernetes for multiple clusters
● Focused on Day 2 Operations
● Uses BOSH
Confidential
BOSH
● Day 2 Operations
● Large-scale cloud software
● Security fixes within 48 hours
● Security aware
● Monitors and resurrects VMs
● Reproducible deployments
Embedded OS
(Windows & Linux)
NSX-T
CPI (15 methods)
v1
v2
v3
...
CVEs
Product Updates
Java | .NET | NodeJS
Pivotal Application
Service (PAS)
Application Code & Frameworks
Buildpacks | Spring Boot | Spring Cloud |
Steeltoe
Elastic | Packaged Software | Spark
Pivotal Container
Service (PKS)
>cf push >kubectl run
YOU build the containerWE build the container
vSphere
Azure &
Azure StackGoogle CloudAWSOpenstack
Pivotal
Network
“3Rs”
Github
Concourse
Concourse
Pivotal Services
Marketplace
Pivotal and
Partner Products
Continuous
delivery
Public Cloud
Services
Customer
Managed
Services
Repair
— CVEs
Repave Rotate
— Credhub
Pivotal Cloud Foundry
Confidential
I haz a Kubernetes.
What does that mean?
Confidential
Confidential
Master
Confidential
Master Worker
Confidential
Master Worker
Kubernetes Cluster
Confidential
Master Worker
Kubernetes Cluster
Master
Master
Worker
Worker
Confidential
Master Worker
Kubernetes Cluster
Master
Master
Worker
Worker
kube-apiserver
The Kubernetes API is the single
source of truth.
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver
kubectl
apply -f myApp.yml
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver etcd
kubectl
apply -f myApp.yml
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver etcd
kubectl
apply -f myApp.yml
scheduler
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver etcd
kubectl
apply -f myApp.yml
scheduler
kube-controller-
manager
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver etcd
kubectl
apply -f myApp.yml
scheduler
kube-controller-
manager
kubelet
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver etcd
kubectl
apply -f myApp.yml
scheduler
kube-controller-
manager
kubelet
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver etcd
kubectl
apply -f myApp.yml
scheduler
kube-controller-
manager
kubelet
myApp
Confidential
Confidential
So… k8s is cool
Confidential
But why do I care again?
Confidential
What am I deploying??
Confidential
Confidential
The Microservices Use Case
So you’re building some
microservices...
Monolith
Microservices
Microservices
● Smaller, simpler and easier to test
● Develop, deploy and run independently
● Organization can scale to many teams
Tradeoffs with Microservices
Pros Cons
Strong Modular Boundaries Distributed Systems
Independent Deployment Eventual Consistency
Diversity of Technology Operational Complexity
Fallacies of Distributed systems
● The network is reliable.
● Latency is zero
● Bandwidth is infinite
● The network is secure.
● Topology doesn't change.
● There is one administrator.
● Transport cost is zero.
● The network is homogeneous.
backendfrontend
Things your microservices ought to do...
• Client-side retries
• Load balancing
• Mutual TLS
• Configurable timeouts
• Collecting metrics
Confidential
how do?
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
● Dev env == production env
● Multi-cloud
● Community convergence & 3rd party integrations
● Flexibility
Confidential
Kubernetes
● Container orchestrator built around Docker
● “Have a datacenter on their laptop”
● Dev env == production env
● Multi-cloud
● Community convergence & 3rd party integrations
● Flexibility
Confidential
Istio
Project to connect, secure, manage and observe microservices.
● Open source
● Platform agnostic
● Polyglot services
What is Istio?
Project to connect, secure, manage and observe microservices.
● Utilizes sidecar proxies
● Service mesh
What is Istio?
Things your microservices ought to do...
• Client-side retries
• Load balancing
• Mutual TLS
• Configurable timeouts
• Collecting metrics
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Istio
subscribe!
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Istio
backends!
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Istio
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Istio
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Istio
Retries
Proxy
Frontend
Proxy
Backend 3
Proxy
Backend 2
Proxy
Backend 1
Istio
Istio Terminology
• Service: unit of (destination) application.
• Service Versions: variants of (destination) application binary.
• Service Registry: keeps track of pods/VMs of a service
• Virtual Service: rule defining what service to send a request to
• Destination Rule: rule defining what to do after destination
service is identified
apiVersion: config.istio.io/v1alpha3
kind: VirtualService
metadata:
name: bananagram
spec:
hosts:
- banana
http:
- route:
- destination:
host: banana
Example Virtual Service Config
apiVersion: config.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: bananagram
spec:
hosts:
- banana
trafficPolicy:
connectionPool:
tcp:
maxConnections: 1
Destination Rule
Confidential
Istio & Kubernetes: Better Together
$ helm template install/kubernetes/helm/istio --name istio --
namespace istio-system > $HOME/istio.yaml
$ kubectl create namespace istio-system
$ kubectl apply -f $HOME/istio.yaml
Confidential
Master
Master
Master
Master
Master
Worker
kube-apiserver
scheduler
kube-controller-
manager
kubelet
istio-pilot
istio-mixer
… etc
Confidential
But wait...
What about Spring Cloud Services?
Spring Cloud
Mission to eliminate boilerplate associated with distributed systems problems for
Spring Boot applications.
Started by using established libraries and servers (nothing was baked into platforms)
● Netflix OSS (Eureka, Ribbon, Hystrix)
● Hashicorp Consul
● Apache Zookeeper
Level of abstraction
Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aenean
commodo ligula eget dolor. Aenean
massa. Cum sociis natoque penatibus
et magnis dis parturient montes,
nascetur ridiculus mus. Donec quam
felis, ultricies nec, pellentesque
● Spring and Istio address the
problems of distributed
systems at different layers of
abstraction
● “Istio helps decouple
operations of a cluster from the
application developer” - Eric
Brewer, Google (VP,
Infrastructure)
Application
Platform Or Container
Orchestrator
IaaS
Istio or Spring Cloud (or both?)
● If the capability is provided by the platform (Istio), use it. Except for …
○ Fallbacks
○ Tracing Propagation
○ Security
● Istio or a service mesh architecture works better for polyglot environments
● But it also depends on your risk propensity
○ Istio GA’d in July 2018
○ Spring Cloud has been around for 4 years
● Performance is also a factor
For more info, watch: A Tale of Two Frameworks
Confidential
To Recap
We Covered
● Kubernetes
● Pivotal Container Service (PKS)
● Microservices
● Istio
● Spring Cloud Services
Its been a journey gif
Confidential
Thank You
@AngelaSChin
Confidential
Example: Retries
Retries: Istio
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: foo
spec:
hosts:
- foo
http:
- route:
- destination:
host: foo
subset: v1
retries:
attempts: 3
Retries: Spring
@Service
class Service {
@Retryable(RemoteAccessException.class)
void service() {
// ... do something
}
@Recover
void recover(RemoteAccessException e)
{
// ... panic
}
}
● Annotation or Template
● Stateless or Stateful
● Flexible Retry Policies
● Backoff Policies (e.g.
exponential)
Confidential
In process vs out of process
architecture
Frontend Backend
A Library!
In-process architecture
Multiple languages, Multiple libraries
Each with…
• Different features
• Different configuration
• Different quirks
Polyglot shouldn't be painful!
Outline
• What your microservices need
• How sidecars help
• Envoy & Istio
• Kubernetes Integration
• Cloud Foundry Integration
Out-of-process architecture
Your App Some service
Separate
process!
Out-of-process architecture
Your App
- retries
- load balancing
- mutual TLS
- timeouts
- metric collection
- etc.
Your
business
logic
here
Your App
(acting as
a service)
Client app
Out-of-process architecture
Confidential

Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud - Angela Chin