SlideShare a Scribd company logo
1 of 21
Download to read offline
Developer Experience Cloud Native
-
Become Efficient and Achieve Parity
Michael Hofmann
https://hofmann-itconsulting.de
Developer Experience Cloud Native
create code
Docker build
& push
deploy to
(local) K8S
test & debug
remote
Git push
build & test
(local)
The Twelve-Factor App
“methodology for building software-as-a-service apps that”:
● “Use declarative formats for setup automation, to minimize time and cost for new
developers joining the project”;
● “Have a clean contract with the underlying operating system, offering maximum
portability between execution environments”;
● “Are suitable for deployment on modern cloud platforms, obviating the need for
servers and systems administration”;
● “Minimize divergence between development and production, enabling
continuous deployment for maximum agility”;
● “And can scale up without significant changes to tooling, architecture, or
development practices”.
https://12factor.net
The Twelve-Factor App
I. Codebase
One codebase tracked in revision control, many
deploys
II. Dependencies
Explicitly declare and isolate dependencies
III. Config
Store config in the environment
IV. Backing services
Treat backing services as attached resources
V. Build, release, run
Strictly separate build and run stages
VI. Processes
Execute the app as one or more stateless processes
VII. Port binding
Export services via port binding
VIII. Concurrency
Scale out via the process model
IX. Disposability
Maximize robustness with fast startup and graceful
shutdown
X. Dev/prod parity
Keep development, staging, and production as similar as
possible
XI. Logs
Treat logs as event streams
XII. Admin processes
Run admin/management tasks as one-off processes
Deviation in Parity: local vs cloud
● operation system
● JDK version
● environment
– ENV vars
– volume mounts
– DNS (myservice.mynamespace.svc.cluster.local)
● backing service (single server / cluster)
(e.g. Redis: SingleServerConfig, ClusterServersConfig)
● Java SecureRandom: in cloud too slow (missing entropy with isolated
CPUs)
The Quest:
How to get
new source code
quick
into container or pod
to keep
parity?
Possible Solutions
● synchronous deployment in Kubernetes
● source reload in Kubernetes pod
● swap deployment of Kubernetes pod
● for completeness: source reload in local container
– no focus in this session
– to many manual tasks necessary (see summary)
Sync Deployment: Skaffold
● handles the workflow for
– building (application and image)
– pushing to registry
– deployment to Kubernetes
● keeps artifacts in sync
● workflow automated or manually
https://skaffold.dev
Sync Deployment
Demo Skaffold
Skaffold Summary
● always full build and deployment cycle
– deactivate JUnits for shorter roundtrip
● remote debug only with manual intervention (pod restart)
● automatic sync of deployment files and Docker images
● cleanup of all (skaffold-ed) resources in cluster
● main usage scenario: keep local and remote in sync
● remote debug is not a first class citizen
● OpenLiberty can reload code on every change
● setting in server.xml
<applicationManager autoExpand=”true”>
● on file basis (app.war) or on individual class files
● concept: sync local class files to remote pod for
reload in running app server
● remote debug with JDWP (java debug wire protocol)
Source Reload: OpenLiberty/Ksync
Ksync
● installs DaemonSet in K8s cluster
● works bi-directional
● local watch process keeps local folder and pod
folder in sync
● new pods will also be synced (scale --replicas=2)
https://github.com/ksync/ksync
OpenLiberty/Ksync Summary
● full parity: code evolution inside running pod
● roundtrip takes only 1-2s
● JDWP is well-engineered
● stable debug connection (no pod restart)
● concept can also be applied to other app servers (e.g.
tomcat)
● remove JDWP agent and debug port in production
Source Reload: Quarkus Live Coding
● start app (in pod) in remote dev mode:
– package app in mutable jar format
– env setting: QUARKUS_LAUNCH_DEVMODE=true
– same as mvn compile quarkus:dev for local dev mode
● intercepts HTTP requests: redeploys app if new code exists
– redeploy takes less than 1 second (even for larger applications)
● connect local agent to remote host:
mvn quarkus:remote-dev -Dquarkus.live-reload.url=
http://my-remote-host:8080
● sync can be delegated to e.g. Ksync (without url in previous command)
Source Reload
Demo Quarkus Live Coding
Quarkus Live Coding Summary
● full parity: code evolution inside running pod
● no need for additional tools
● very quick roundtrip (< 1s)
● stable debug connection (JDWP)
● do not use dev-mode in production
– app must be repackaged for production
– env setting and debug port must be deleted
Service-C (Pod)
Service-B (Pod)
swapped
Service-A (Pod)
Service-B (Pod)
Swap Deployment
local
Kubernetes
Env
Volume
Env
Volume
Swap Deployment
● debugging a service mesh
● substitutes K8S pod with a two-way network proxy
● proxies data from K8S environment (e.g., TCP connections,
environment variables, volumes) to local process
● local process has its networking transparently overridden:
DNS calls and TCP connections are routed to K8S
● Bridge to Kubernetes or Telepresence
https://marketplace.visualstudio.com/items?itemName=mindaro.mindaro
https://www.telepresence.io
Swap Deployment
Demo Bridge to Kubernetes
Swap Deployment Summary
● parity broken only on OS or JDK (env, mount, DNS parity)
● local development with local debugging
● no manipulation of image or settings necessary
● Non root account: can be set but a little complicated (Docker or env-settings)
● individual traffic
– Telepresence additional service (commercial)
– Bridge to Kubernetes out-of-the-box
● main usage scenarios: develop and debug service mesh local with nearly
full parity
Tool OS/JDK ENV DNS Mount Debug Efficient
Source Reload
(Local Container)
mvn
liberty:devc
manually
--env
kubefwd
manually
--mount
Remote
Sync Deployment Skaffold Remote
Source Reload
(Kubernetes Pod)
OpenLiberty/
Ksync
Quarkus Live
Coding
Remote
Swap Deployment
Bridge to
Kubernetes
telepresence
Local
Summary

More Related Content

What's hot

Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014
CloudBees
 
Developer Productivity Engineering with Gradle
Developer Productivity Engineering with GradleDeveloper Productivity Engineering with Gradle
Developer Productivity Engineering with Gradle
All Things Open
 
Fine-Tuning of Agile Development
Fine-Tuning of Agile DevelopmentFine-Tuning of Agile Development
Fine-Tuning of Agile Development
Thoughtworks
 

What's hot (20)

High Performance Cloud-Native Microservices IndyCloudConf 2020
High Performance Cloud-Native Microservices IndyCloudConf 2020High Performance Cloud-Native Microservices IndyCloudConf 2020
High Performance Cloud-Native Microservices IndyCloudConf 2020
 
Docker Best Practices Workshop
Docker Best Practices WorkshopDocker Best Practices Workshop
Docker Best Practices Workshop
 
An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...
An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...
An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...
 
DCEU 18: Continuous Delivery with Docker Containers and Java: The Good, the B...
DCEU 18: Continuous Delivery with Docker Containers and Java: The Good, the B...DCEU 18: Continuous Delivery with Docker Containers and Java: The Good, the B...
DCEU 18: Continuous Delivery with Docker Containers and Java: The Good, the B...
 
DevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of JenkinsDevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of Jenkins
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
 
Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014
 
Improving WordPress Development and Deployments with Docker
Improving WordPress Development and Deployments with DockerImproving WordPress Development and Deployments with Docker
Improving WordPress Development and Deployments with Docker
 
Developer Productivity Engineering with Gradle
Developer Productivity Engineering with GradleDeveloper Productivity Engineering with Gradle
Developer Productivity Engineering with Gradle
 
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
 
Fine-Tuning of Agile Development
Fine-Tuning of Agile DevelopmentFine-Tuning of Agile Development
Fine-Tuning of Agile Development
 
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
 
Distributed Docker Pipeline Architecture with CloudBees Jenkins Enterprise
Distributed Docker Pipeline Architecture with CloudBees Jenkins EnterpriseDistributed Docker Pipeline Architecture with CloudBees Jenkins Enterprise
Distributed Docker Pipeline Architecture with CloudBees Jenkins Enterprise
 
Adopting Java for the Serverless world at AWS User Group Pretoria
Adopting Java for the Serverless world at AWS User Group PretoriaAdopting Java for the Serverless world at AWS User Group Pretoria
Adopting Java for the Serverless world at AWS User Group Pretoria
 
SkyBase - a Devops Platform for Hybrid Cloud
SkyBase - a Devops Platform for Hybrid CloudSkyBase - a Devops Platform for Hybrid Cloud
SkyBase - a Devops Platform for Hybrid Cloud
 
Continuous Testing
Continuous TestingContinuous Testing
Continuous Testing
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
Unleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket CloudUnleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket Cloud
 
Jenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipelineJenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipeline
 
Jenkins + Docker = Continuous Improvement
Jenkins + Docker = Continuous ImprovementJenkins + Docker = Continuous Improvement
Jenkins + Docker = Continuous Improvement
 

Similar to Developer Experience Cloud Native - Become Efficient and Achieve Parity

Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Michael Hofmann
 

Similar to Developer Experience Cloud Native - Become Efficient and Achieve Parity (20)

Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015
 
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
 
Containers and Orchestration approaches
Containers and Orchestration approachesContainers and Orchestration approaches
Containers and Orchestration approaches
 
Making Service Deployments to AWS a breeze with Nova
Making Service Deployments to AWS a breeze with NovaMaking Service Deployments to AWS a breeze with Nova
Making Service Deployments to AWS a breeze with Nova
 
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
 
Kubernetes - training micro-dragons without getting burnt
Kubernetes -  training micro-dragons without getting burntKubernetes -  training micro-dragons without getting burnt
Kubernetes - training micro-dragons without getting burnt
 
Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
Containers&Orchestration Approaches
Containers&Orchestration ApproachesContainers&Orchestration Approaches
Containers&Orchestration Approaches
 
The path to a serverless-native era with Kubernetes
The path to a serverless-native era with KubernetesThe path to a serverless-native era with Kubernetes
The path to a serverless-native era with Kubernetes
 
ContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017
 
Red Hat and kubernetes: awesome stuff coming your way
Red Hat and kubernetes:  awesome stuff coming your wayRed Hat and kubernetes:  awesome stuff coming your way
Red Hat and kubernetes: awesome stuff coming your way
 
The App Developer's Kubernetes Toolbox
The App Developer's Kubernetes ToolboxThe App Developer's Kubernetes Toolbox
The App Developer's Kubernetes Toolbox
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
Test cloud application deployments locally and in CI without staging environm...
Test cloud application deployments locally and in CI without staging environm...Test cloud application deployments locally and in CI without staging environm...
Test cloud application deployments locally and in CI without staging environm...
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
 

More from Michael Hofmann

More from Michael Hofmann (12)

Service Specific AuthZ In The Cloud Infrastructure
Service Specific AuthZ In The Cloud InfrastructureService Specific AuthZ In The Cloud Infrastructure
Service Specific AuthZ In The Cloud Infrastructure
 
New Ways To Production - Stress-Free Evolution Of Your Cloud Applications
New Ways To Production - Stress-Free Evolution Of Your Cloud ApplicationsNew Ways To Production - Stress-Free Evolution Of Your Cloud Applications
New Ways To Production - Stress-Free Evolution Of Your Cloud Applications
 
The Easy Way to Secure Microservices
The Easy Way to Secure MicroservicesThe Easy Way to Secure Microservices
The Easy Way to Secure Microservices
 
Service Mesh vs. Frameworks: Where to put the resilience?
Service Mesh vs. Frameworks: Where to put the resilience?Service Mesh vs. Frameworks: Where to put the resilience?
Service Mesh vs. Frameworks: Where to put the resilience?
 
Service Mesh vs. Frameworks: Where to put the resilience?
Service Mesh vs. Frameworks: Where to put the resilience?Service Mesh vs. Frameworks: Where to put the resilience?
Service Mesh vs. Frameworks: Where to put the resilience?
 
Servicierung von Monolithen - Der Weg zu neuen Technologien bis hin zum Servi...
Servicierung von Monolithen - Der Weg zu neuen Technologien bis hin zum Servi...Servicierung von Monolithen - Der Weg zu neuen Technologien bis hin zum Servi...
Servicierung von Monolithen - Der Weg zu neuen Technologien bis hin zum Servi...
 
Service Mesh mit Istio und MicroProfile - eine harmonische Kombination?
Service Mesh mit Istio und MicroProfile - eine harmonische Kombination?Service Mesh mit Istio und MicroProfile - eine harmonische Kombination?
Service Mesh mit Istio und MicroProfile - eine harmonische Kombination?
 
Service Mesh - kilometer 30 in a microservice marathon
Service Mesh - kilometer 30 in a microservice marathonService Mesh - kilometer 30 in a microservice marathon
Service Mesh - kilometer 30 in a microservice marathon
 
Service Mesh - Kilometer 30 im Microservices-Marathon
Service Mesh - Kilometer 30 im Microservices-MarathonService Mesh - Kilometer 30 im Microservices-Marathon
Service Mesh - Kilometer 30 im Microservices-Marathon
 
API-Economy bei Financial Services – Kein Stein bleibt auf dem anderen
API-Economy bei Financial Services – Kein Stein bleibt auf dem anderenAPI-Economy bei Financial Services – Kein Stein bleibt auf dem anderen
API-Economy bei Financial Services – Kein Stein bleibt auf dem anderen
 
Microprofile.io - Cloud Native mit Java EE
Microprofile.io - Cloud Native mit Java EEMicroprofile.io - Cloud Native mit Java EE
Microprofile.io - Cloud Native mit Java EE
 
Microservices mit Java EE - am Beispiel von IBM Liberty
Microservices mit Java EE - am Beispiel von IBM LibertyMicroservices mit Java EE - am Beispiel von IBM Liberty
Microservices mit Java EE - am Beispiel von IBM Liberty
 

Recently uploaded

JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined DeckJax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Marc Lester
 

Recently uploaded (20)

The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
 
Sourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing ManufacturerSourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing Manufacturer
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 
The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion Production
 
Malaysia E-Invoice digital signature docpptx
Malaysia E-Invoice digital signature docpptxMalaysia E-Invoice digital signature docpptx
Malaysia E-Invoice digital signature docpptx
 
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined DeckJax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined Deck
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 

Developer Experience Cloud Native - Become Efficient and Achieve Parity

  • 1. Developer Experience Cloud Native - Become Efficient and Achieve Parity Michael Hofmann https://hofmann-itconsulting.de
  • 2. Developer Experience Cloud Native create code Docker build & push deploy to (local) K8S test & debug remote Git push build & test (local)
  • 3. The Twelve-Factor App “methodology for building software-as-a-service apps that”: ● “Use declarative formats for setup automation, to minimize time and cost for new developers joining the project”; ● “Have a clean contract with the underlying operating system, offering maximum portability between execution environments”; ● “Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration”; ● “Minimize divergence between development and production, enabling continuous deployment for maximum agility”; ● “And can scale up without significant changes to tooling, architecture, or development practices”. https://12factor.net
  • 4. The Twelve-Factor App I. Codebase One codebase tracked in revision control, many deploys II. Dependencies Explicitly declare and isolate dependencies III. Config Store config in the environment IV. Backing services Treat backing services as attached resources V. Build, release, run Strictly separate build and run stages VI. Processes Execute the app as one or more stateless processes VII. Port binding Export services via port binding VIII. Concurrency Scale out via the process model IX. Disposability Maximize robustness with fast startup and graceful shutdown X. Dev/prod parity Keep development, staging, and production as similar as possible XI. Logs Treat logs as event streams XII. Admin processes Run admin/management tasks as one-off processes
  • 5. Deviation in Parity: local vs cloud ● operation system ● JDK version ● environment – ENV vars – volume mounts – DNS (myservice.mynamespace.svc.cluster.local) ● backing service (single server / cluster) (e.g. Redis: SingleServerConfig, ClusterServersConfig) ● Java SecureRandom: in cloud too slow (missing entropy with isolated CPUs)
  • 6. The Quest: How to get new source code quick into container or pod to keep parity?
  • 7. Possible Solutions ● synchronous deployment in Kubernetes ● source reload in Kubernetes pod ● swap deployment of Kubernetes pod ● for completeness: source reload in local container – no focus in this session – to many manual tasks necessary (see summary)
  • 8. Sync Deployment: Skaffold ● handles the workflow for – building (application and image) – pushing to registry – deployment to Kubernetes ● keeps artifacts in sync ● workflow automated or manually https://skaffold.dev
  • 10. Skaffold Summary ● always full build and deployment cycle – deactivate JUnits for shorter roundtrip ● remote debug only with manual intervention (pod restart) ● automatic sync of deployment files and Docker images ● cleanup of all (skaffold-ed) resources in cluster ● main usage scenario: keep local and remote in sync ● remote debug is not a first class citizen
  • 11. ● OpenLiberty can reload code on every change ● setting in server.xml <applicationManager autoExpand=”true”> ● on file basis (app.war) or on individual class files ● concept: sync local class files to remote pod for reload in running app server ● remote debug with JDWP (java debug wire protocol) Source Reload: OpenLiberty/Ksync
  • 12. Ksync ● installs DaemonSet in K8s cluster ● works bi-directional ● local watch process keeps local folder and pod folder in sync ● new pods will also be synced (scale --replicas=2) https://github.com/ksync/ksync
  • 13. OpenLiberty/Ksync Summary ● full parity: code evolution inside running pod ● roundtrip takes only 1-2s ● JDWP is well-engineered ● stable debug connection (no pod restart) ● concept can also be applied to other app servers (e.g. tomcat) ● remove JDWP agent and debug port in production
  • 14. Source Reload: Quarkus Live Coding ● start app (in pod) in remote dev mode: – package app in mutable jar format – env setting: QUARKUS_LAUNCH_DEVMODE=true – same as mvn compile quarkus:dev for local dev mode ● intercepts HTTP requests: redeploys app if new code exists – redeploy takes less than 1 second (even for larger applications) ● connect local agent to remote host: mvn quarkus:remote-dev -Dquarkus.live-reload.url= http://my-remote-host:8080 ● sync can be delegated to e.g. Ksync (without url in previous command)
  • 16. Quarkus Live Coding Summary ● full parity: code evolution inside running pod ● no need for additional tools ● very quick roundtrip (< 1s) ● stable debug connection (JDWP) ● do not use dev-mode in production – app must be repackaged for production – env setting and debug port must be deleted
  • 17. Service-C (Pod) Service-B (Pod) swapped Service-A (Pod) Service-B (Pod) Swap Deployment local Kubernetes Env Volume Env Volume
  • 18. Swap Deployment ● debugging a service mesh ● substitutes K8S pod with a two-way network proxy ● proxies data from K8S environment (e.g., TCP connections, environment variables, volumes) to local process ● local process has its networking transparently overridden: DNS calls and TCP connections are routed to K8S ● Bridge to Kubernetes or Telepresence https://marketplace.visualstudio.com/items?itemName=mindaro.mindaro https://www.telepresence.io
  • 20. Swap Deployment Summary ● parity broken only on OS or JDK (env, mount, DNS parity) ● local development with local debugging ● no manipulation of image or settings necessary ● Non root account: can be set but a little complicated (Docker or env-settings) ● individual traffic – Telepresence additional service (commercial) – Bridge to Kubernetes out-of-the-box ● main usage scenarios: develop and debug service mesh local with nearly full parity
  • 21. Tool OS/JDK ENV DNS Mount Debug Efficient Source Reload (Local Container) mvn liberty:devc manually --env kubefwd manually --mount Remote Sync Deployment Skaffold Remote Source Reload (Kubernetes Pod) OpenLiberty/ Ksync Quarkus Live Coding Remote Swap Deployment Bridge to Kubernetes telepresence Local Summary