Spring Boot, Microservices, Containers and Kubernetes - How To
-
Upload
spring-by-pivotal -
Category
Technology
-
view
3.184 -
download
5
Transcript of Spring Boot, Microservices, Containers and Kubernetes - How To
![Page 1: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/1.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Java MicroservicesWith Kubernetes - How To
![Page 2: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/2.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
SPRINGONE2GXWASHINGTON, DC
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Microservices, Containers, Kubernetes - How To
Ray Tsang / Bret McGowen@saturnism / @bretmcg
![Page 3: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/3.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Bret McGowenDeveloper AdvocateGoogle Cloud PlatformNew York, NY
@bretmcg
About Bret
![Page 4: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/4.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Ray TsangDeveloper Advocate
@saturnism | +RayTsang
![Page 5: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/5.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Ray TsangDeveloperArchitectTravelerPhotographer
flickr.com/saturnism
![Page 6: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/6.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Microservices?
You probably heard a lot already!
No theories here - just a how to
![Page 7: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/7.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
![Page 8: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/8.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Hello World Service - Greet
Guestbook Service - Create
Guestbook Service - Retrieve
![Page 9: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/9.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
GuestbookUI
Hello World Service
Redis
session replication
greeting
MySQL
GuestbookService
CRUD
![Page 10: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/10.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Package & Deploymentapplication.ear
app.war
helloworld-service.jar
guestbook-service.jar
apache-xyz.jar
application.war
/...
helloworld-service.jar
guestbook-service.jar
apache-xyz.jar
![Page 11: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/11.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Machine
app.war / app.ear
Application Server
Kernel
Shell / CLI / Tools
![Page 12: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/12.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Machine
app.war / app.ear
Application Server
Kernel
Shell / CLI / Tools
Machine
app.war / app.ear
Application Server
Kernel
Shell / CLI / Tools
Machine
app.war / app.ear
Application Server
Kernel
Shell / CLI / Tools
![Page 13: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/13.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Microservices Way?
![Page 14: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/14.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Package & Deployment
helloworld-service.jar
guestbook-service.jar
app.jar
![Page 15: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/15.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Deployment? Just run it!
java -jar helloworld-service.jar
java -jar guestbook-service.jar
java -jar app.jar
![Page 16: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/16.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Characteristics
Easy to deploy
Fast startup time
Self-contained Jar
![Page 17: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/17.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Embedded Java ServersSpring Boot, JBoss Wildfly Swarm, Fluent-HTTP, Vert.x, Ninja,
Spark, Jodd, ...
![Page 18: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/18.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Let’s see some code
![Page 19: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/19.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
So many servicesDeploy, Manage, Ports, Discovery, Isolation… How?
![Page 20: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/20.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Containers
![Page 21: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/21.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Old Way: Shared machines
kernel
libs
app
app app
No isolation
No namespacing
Common libs
Highly coupled apps and OS
app
![Page 22: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/22.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Old Java Way: Shared App Server
App Server
libs
app
app app
No isolation
No namespacing
Common libs - shouldn’t really happen in Java apps...
app
![Page 23: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/23.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Old Way: Virtual machines
Some isolation
Expensive and inefficient
Still highly coupled to the guest OS
Hard to manageapp
libs
kernel
libs
app app
kernel
app
libs
libs
kernel
kernel
![Page 24: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/24.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
New Way: Containers
libs
app
kernel
libs
app
libs
app
libs
app
![Page 25: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/25.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Containerize Option #1
Dockerfile
![Page 26: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/26.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Containerize Option #2
spotify/docker-maven-plugin
mvn docker:build
![Page 27: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/27.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Containerize Option #3
Docker Hub / GitHub
saturnism/spring-boot
![Page 28: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/28.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Let’s run the container!
docker run -ti -p 8080:8080 helloworld-service
![Page 29: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/29.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
MySQL
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=yourpassword -e MYSQL_DATABASE=app mysql
![Page 30: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/30.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Redis
docker run -d --name redis redis
![Page 31: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/31.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Guestbook Service
docker run -ti --name guestbookservice --link mysql:mysql saturnism/guestbook-service
![Page 32: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/32.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Hello World Service
docker run -ti --name helloworldservice \saturnism/spring-boot-helloworld-service:1.0
![Page 33: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/33.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Guestbook UI
docker run -ti --rm --link redis:redis \--link helloworldservice:helloworldservice \--link guestbookservice:guestbookservice \
-p 8080:8080 saturnism/spring-boot-helloworld-ui
![Page 34: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/34.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Docker Compose
docker-compose up
![Page 35: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/35.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Containers & Orchestration To the Rescue!
![Page 36: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/36.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Everything at Google runs in containers
![Page 37: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/37.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Everything at Google runs in containers
Launch over 2 billion containers per week.
![Page 38: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/38.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
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
Developer View
![Page 39: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/39.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
web browsers
BorgMaster
link shard
UI shardBorgMaster
link shard
UI shardBorgMaster
link shard
UI shardBorgMaster
link shard
UI shard
Scheduler
borgcfg web browsers
scheduler
Borglet Borglet Borglet Borglet
Config file
BorgMaster
link shard
UI shard
persistent store (Paxos)
Binary
Developer View
What justhappened?
![Page 40: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/40.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Hello world!
Hello world!
Hello world!
Hello world!Hello
world! Hello world! Hello
world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world! Hello
world!
Hello world!
Hello world!
Hello world!
Image by Connie Zhou
Hello world!
Hello world!
Hello world! Hello
world!
Hello world! Hello
world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world! Hello
world!
Hello world! Hello
world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world! Hello
world!
Hello world! Hello
world!
Hello world!
Hello world!
![Page 41: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/41.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Developer View
![Page 42: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/42.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Data Center as One Machine
![Page 43: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/43.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Open Source To the Rescue!
![Page 44: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/44.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Enter Kubernetes
Greek for “Helmsman”; also the root of the word “Governor”
• Container orchestrator
• Runs containers
• Supports multiple cloud and bare-metal environments
• Inspired and informed by Google’s experiences and internal systems
• Open source, written in Go
Manage applications, not machines
![Page 45: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/45.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
GuestbookUI
Hello World Service
Redis
session replication
greeting
MySQL
GuestbookService
CRUD
![Page 46: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/46.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Version 1.0
Hosted on GitHub
450+ contributors
15,900+ commits
9,600+ GitHub stars
CoreOS
HP
IBM
Mesosphere
Microsoft
Project Partners
Open Source Community
Pivotal
Red Hat
SaltStack
VMWare
https://github.com/GoogleCloudPlatform/kubernetes
![Page 47: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/47.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Challenges
Which host machine(s) should each process run on?
How does the application code find the cache process?
How do we keep all of these processes running?
What happens if a host machine has trouble?
Are the processes healthy?
How do we scale when load changes?
Run this in another environment? QA, dev, another cloud, your servers?
![Page 48: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/48.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
web browsers
Scheduler
kubectl web browsers
scheduler
Kubelet Kubelet Kubelet Kubelet
Config file
Kubernetes Master
Container Image
Developer View
What justhappened?
![Page 49: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/49.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Developer View
spec: containers: - name: mysql image: mysql resources: limits: memory: "128Mi" cpu: "0.1" ports: - containerPort: 3306 protocol: TCP replicas: 110000
![Page 50: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/50.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Cluster of Machines as One
![Page 51: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/51.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
PodsThe atom of cluster scheduling & placement
Ephemeral
● can die and be replaced
Small group of containers & volumes
Tightly coupled
Shared namespace
● share IP address & localhostPod
Log Collector Web Server
Volume
Consumers
![Page 52: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/52.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Pod Networking
10.1.1.0/24
10.1.1.93
10.1.1.113
10.1.2.0/24
10.1.2.118
10.1.3.0/24
10.1.3.129
![Page 53: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/53.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Responsible for maintaining the desired state
Monitor the current state
Similar to a process supervisor
Replication Controller
observe
diff
act
![Page 54: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/54.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Pod
ContainerContainerContainerContainer
Node2
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node4
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node3
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 6
Kubelet Proxy Kubelet Proxy
Kubelet ProxyKubelet Proxy
![Page 55: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/55.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Pod
ContainerContainerContainerContainer
Node2
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node4
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node3
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 4
Kubelet Proxy Kubelet Proxy
Kubelet ProxyKubelet Proxy
![Page 56: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/56.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Pod
ContainerContainerContainerContainer
Node4
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node3
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 4
Kubelet Proxy Kubelet Proxy
Kubelet Proxy
![Page 57: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/57.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Node3
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 6
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node4
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
![Page 58: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/58.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Node3
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 8
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node4
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Node2
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Kubelet Proxy
![Page 59: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/59.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Node3
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 6
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node4
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node2
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
![Page 60: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/60.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Replication Controllers
Node1
Kubelet Proxy
Node3
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Replication Controller- Desired = 6- Current = 6
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node4
Kubelet Proxy
Pod
ContainerContainerContainerContainer
Pod
ContainerContainerContainerContainer
Node2
Kubelet Proxy
Pod
ContainerContainerContainerContainer
![Page 61: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/61.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
A group of pods that act as one == Service
Load balances across healthy pods
Gets a stable virtual IP and port• also a DNS name
Hide complexity• ideal for non-native apps
Servicesstable IP / port
![Page 62: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/62.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Labels
App == Guestbook
App: GuestbookPhase: Test
Role: Frontend
App: GuestbookPhase: Test
Role: Backend
App: GuestbookPhase: Dev
Role: Frontend
App: GuestbookPhase: Dev
Role: Backend
App: EncodingPhase: Prod
Role: Backend
![Page 63: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/63.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Labels
Role == Frontend
App: GuestbookPhase: Test
Role: Frontend
App: GuestbookPhase: Test
Role: Backend
App: GuestbookPhase: Dev
Role: Frontend
App: GuestbookPhase: Dev
Role: Backend
App: EncodingPhase: Prod
Role: Backend
![Page 64: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/64.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Labels
App: GuestbookPhase: Test
Role: Frontend
App: GuestbookPhase: Test
Role: Backend
App: GuestbookPhase: Dev
Role: Frontend
App: GuestbookPhase: Dev
Role: Backend
App == GuestbookRole == Backend
App: EncodingPhase: Prod
Role: Backend
![Page 65: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/65.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Putting it all together
Service
Label selectors: version = 1.0 type = Frontend
Service
Label selector:Role: FE
Replication Controller
Pod Pod
frontend
Pod
Version: v1 Version: v1
Replication Controller
Role: FEVersion: v1#pods = 2
show: version = v2
Role: FE Role: FE
Replication ControllerPod
frontend
![Page 66: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/66.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Canary
Service
Label selectors: version = 1.0 type = Frontend
Replication Controller
Pod Pod
frontend
PodReplication ControllerReplication Controller
Role: FEVersion: v2#pods = 1
show: version = v2
Pod
frontend
Pod
Version: v2Role: FE
Service
Label selector:Role: FE
Version: v1 Version: v1
Replication Controller
Role: FEVersion: v1#pods = 2
show: version = v2
Role: FE Role: FE
![Page 67: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/67.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Service discovery
Read service IP addresses via environmental variables
![Page 68: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/68.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Service discovery
Kubernetes API
or…
DNS Lookups!
ping redis
![Page 69: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/69.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
A small group of tightly coupled
containers
Example: application & log collector
A loop that drives current state towards
desired state
Example: replication controller
A set of running pods that work together
Example: load-balanced backends
Arbitrary metadata to organize components
Example: phase=productionrole=frontend
Replication Controller Service LabelsPod
![Page 70: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/70.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Live Demo
![Page 71: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/71.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Hello World Service - Greet
Guestbook Service - Create
Guestbook Service - Retrieve
![Page 72: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/72.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
GuestbookUI
Hello World Service
Redis
session replication
greeting
MySQL
GuestbookService
CRUD
![Page 73: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/73.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Versioning container image
docker tag spring-boot-demo spring-boot-demo:1.0
![Page 74: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/74.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Staging vs. production
Use labels - deploy in the same infrastructure
![Page 75: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/75.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Canary
Use service, and replication controllers to canary new versions
![Page 76: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/76.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Rollback
Super simple with versioned containers
![Page 77: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/77.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Rolling upgrade
Similar to canary, but slowly let the new version take over
![Page 78: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/78.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Vagrantexport KUBERNETES_PROVIDER=vagrant
curl -sS https://get.k8s.io | bash
Google Container Engine - Betahttp://cloud.google.com/container-engine
http://kubernetes.io/gettingstarted/
![Page 79: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/79.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Try out Google Container Engine
https://cloud.google.com/container-engine/
![Page 80: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/80.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Try Kubernetes Today!
![Page 81: Spring Boot, Microservices, Containers and Kubernetes - How To](https://reader031.fdocuments.in/reader031/viewer/2022021422/5875860d1a28ab901c8b4c67/html5/thumbnails/81.jpg)
@saturnism @bretmcg @kubernetesio @googlecloud #s2gx
Thanks!
Images by Connie Zhou
http://kubernetes.io http://bit.ly/1QLg5E1