SlideShare a Scribd company logo
1 of 41
Continuous Deployment with
Akka.Cluster and Kubernetes
By Aaron Stannard,
Petabridge CEO
Akka.NET Co-Founder
What We’re Going to Learn
Today
• Akka.Cluster Overview
• Docker & .NET Core Fundamentals
• Akka.Cluster & Docker Best Practices
• Kubernetes Concepts
• Azure Kubernetes Service
• Putting it all Together into Continuous
Deployment
Why .NET Core?
• Cross-platform
• Extremely fast
• Lightweight
• Future of .NET
• Plays well with
Docker
Why Docker?
• Ubiquitous – runs
everywhere, used
everywhere.
• Easy, reproducible
configuration format –
Dockerfiles.
• Composable.
• Easy to share output
via compiled Docker
images.
Why Kubernetes?
• Ubiquitous – runs on-
premise, on the cloud,
etc…
• Robust deployment
models – including
handling for stateful
apps.
• Rich ecosystem.
Why Azure Kubernetes
Service?
• Takes only a few
minutes to setup.
• Integrates well with
Azure DevOps.
• Great environment for
learning K8s.
Akka.Cluster Continuous
Deployment Process
Demo
View of an Akka.NET Cluster
Each node is its
own ActorSystem
How Akka.Cluster State Gets
Distributed: Routers
Other State Distribution Tools
• Akka.Cluster.Tools
– Distributed Publish-Subscribe
– ClusterClient
• Akka.Cluster.Sharding
Working with .NET Core,
Akka.NET, and Docker
Docker Key Terms
• “Image” – a compiled image containing all of the files
needed to execute the process.
• “Repository” – a collection of named and tagged images
hosted at a specific URI.
• “Container” – represents a running instance of a Docker
image on a host machine.
• “Host” – a machine running the Docker engine, capable
of hosting 1 or more running containers.
DockerHub – Public Images
Docker Container Hosting
Bootstrapping Akka.Cluster
• Need to program Akka.Remote to
automatically listen to reachable host +
port inside Docker vNet.
• Need to program Akka.Cluster to contact
seed nodes inside Docker vNet.
• Need to program Akka.Cluster to leave
cluster gracefully prior to / during container
shutdown.
Akka.Bootstrap.Docker
PackageCalls Akka.Bootstrap.Docker
parser – injects runtime &
environment networking values
directly into HOCON prior to
starting ActorSystem.
1. If CLUSTER_IP environment variable is set, that becomes akka.remote.dot-
netty.tcp.public-hostname. If not, then Dns.GetHostName() is used.
2. CLUSTER_PORT environment variable is used for dot-netty.tcp.port.
3. CLUSTER_SEEDS environment variable is a comma-delimited list of addresses.
Akka.NET Dockerfile
FROM microsoft/dotnet:2.1-sdk AS base
WORKDIR /app
# should be a comma-delimited list
ENV CLUSTER_SEEDS "[]"
ENV CLUSTER_IP ""
ENV CLUSTER_PORT "5213"
#Akka.Remote inbound listening endpoint
EXPOSE 5213
COPY ./bin/Release/netcoreapp2.1/publish/ /app
# Install Petabridge.Cmd client
RUN dotnet tool install --global pbm
# Needed because https://stackoverflow.com/questions/51977474/install-dotnet-core-tool-
dockerfile
ENV PATH="${PATH}:/root/.dotnet/tools"
# RUN pbm help
CMD ["dotnet", "WebCrawler.CrawlService.dll"]
Name of the base image we’re
going to use. Taken from the
public Microsoft .NET Core
repository on DockerHub
Set of environment variables
expected by Akka.Bootstrap.Docker
The container’s port expose to the
Docker network
Copy application files from host machine
to container working directory
Execute command inside container
Container’s process entrypoint. If this
process dies, the container dies.
Using Petabridge.Cmd Inside
Docker
• Provides instrumentation to managing,
viewing cluster from inside Docker
network.
• Can be used to trigger graceful shutdowns
of containers.
• Secured inside container network – have
to be able to access host machine to
invoke pbm.
Docker Image Publish Process
Private Docker Registries
• Don’t publish your company’s code onto
DockerHub.
• Use Azure Container Registry (ACR) or
private hosts or services instead.
Kubernetes Core Concepts
• K8s is an “orchestration” platform – networks
multiple container hosts together into unified
abstraction.
• Applications are deployed to the K8s cluster –
K8s then orchestrates the instantiation of
containers across hosts.
• Applications define via configuration:
– Which parts can be exposed publicly and how.
– How different parts of application can be deployed and
managed.
Kubernetes Core Concepts
K8s Infrastructure on Azure AKS
K8s Key Terms (for
Akka.Cluster)
• “Pod” – represents a single application unit
of execution. Consists of 1 or more Docker
container.
• “Stateful set” – a deployment group of
identical pods working together as a
stateful service.
• “Service” – defines how a stateful set
exposes itself to other services within K8s
and Akka.NET cluster.
Akka.Cluster K8s Methodology
• All applications are deployed as stateful
sets
– State is fundamental to how Akka.Cluster
works
• All internal Akka.Cluster functionality is
exposed as “ClusterIp” services
• External / public functionality can exposed
as a “LoadBalancer” service or otherwise
• Petabridge.Cmd used for node exits
• Deployments / rollbacks performed by
K8s Stateful Set YAML File (pt1)
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: lighthouse
labels:
app: lighthouse
spec:
serviceName: lighthouse
replicas: 3
selector:
matchLabels:
app: lighthouse
template:
metadata:
labels:
app: lighthouse
spec:
terminationGracePeriodSeconds: 35
containers:
- name: lighthouse
image: webcrawler.lighthouse:0.2.4
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "pbm 127.0.0.1:9110 cluster leave"]
Declares “lighthouse” stateful set
Declares number of replicas in initial
deployment
Specifies the container name inside the pod
and the Docker image used.
Tells K8s to invoke this command prior to
Terminating any pods in this stateful set.
K8s Stateful Set YAML File (pt2)
env:
- name: ACTORSYSTEM
value: webcrawler
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: CLUSTER_IP
value: "$(POD_NAME).lighthouse"
- name: CLUSTER_SEEDS
value: akka.tcp://webcrawler@lighthouse-0.lighthouse:4053,akka.tcp://webcrawler@lighthouse-
1.lighthouse:4053,akka.tcp://webcrawler@lighthouse-2.lighthouse:4053
livenessProbe:
tcpSocket:
port: 4053
ports:
- containerPort: 4053
protocol: TCP
Populates the POD_NAME environment
variable using K8s metadata at deployment
time.
Populates unique per-node hostname
consumed by Akka.Bootstrap.Docker.
Seed nodes
Liveness probe. Terminates + restarts
container if this check fails. Using
Akka.Remote inbound port.
Container port – exposed to internal
K8s network.
K8s ClusterIP Service YAML
apiVersion: v1
kind: Service
metadata:
name: lighthouse
labels:
app: lighthouse
spec:
clusterIP: None
ports:
- port: 4053
selector:
app: lighthouse
Exposes Lighthouse services across-hosts on
their container port (4053) and host IP
addresses. Not accessible outside of K8s cluster.
Tells K8s that this service points to the
“lighthouse” stateful set we deployed earlier.
Creating the Initial K8s Cluster
kubectl apply –f k8s-lighthouse-service.yaml
kubectl apply –f k8s-crawler-service.yaml
kubectl apply –f k8s-web-service.yaml
Etc…
Azure Kubernetes Service
(AKS)
• Managed K8s on top of Azure virtual
machines and other resources.
• Easy to setup and instrument
– Azure CLI makes it easy to communicate with
AKS via kubectl.
– Works well with Azure DevOps.
– Dev Spaces make it easy to work across
multiple people & teams.
• Great environment for learning K8s.
Akka.Cluster Continuous
Deployment Process
Links and Further Reading
• Source: https://github.com/petabridge/Cluster.WebCrawler
• Petabridge.Cmd: https://cmd.petabridge.com/
• Akka.Bootstrap.Docker: https://github.com/petabridge/akkadotnet-bootstrap
• Akka.HealthCheck.Cluster: https://github.com/petabridge/akkadotnet-
healthcheck
• AKS Quickstart Tutorial: https://docs.microsoft.com/en-us/azure/aks/tutorial-
kubernetes-prepare-app
• AKS + kubectl CLI Tutorial: https://docs.microsoft.com/en-
us/azure/aks/kubernetes-walkthrough
• Akka.Cluster, Docker, K8s Training Tour:
https://trainingtour2019.petabridge.com/

More Related Content

What's hot

PLC(Programmable Logic Controller)-Control system Engineering.
PLC(Programmable Logic Controller)-Control system Engineering.PLC(Programmable Logic Controller)-Control system Engineering.
PLC(Programmable Logic Controller)-Control system Engineering.Tahmid Rongon
 
Interesting and Useful Features of the DeltaV PID Controller
Interesting and Useful Features of the DeltaV PID ControllerInteresting and Useful Features of the DeltaV PID Controller
Interesting and Useful Features of the DeltaV PID ControllerJim Cahill
 
디지털통신 9
디지털통신 9디지털통신 9
디지털통신 9KengTe Liao
 

What's hot (6)

PLC(Programmable Logic Controller)-Control system Engineering.
PLC(Programmable Logic Controller)-Control system Engineering.PLC(Programmable Logic Controller)-Control system Engineering.
PLC(Programmable Logic Controller)-Control system Engineering.
 
Simbologia
Simbologia Simbologia
Simbologia
 
Interesting and Useful Features of the DeltaV PID Controller
Interesting and Useful Features of the DeltaV PID ControllerInteresting and Useful Features of the DeltaV PID Controller
Interesting and Useful Features of the DeltaV PID Controller
 
Deconvolution
DeconvolutionDeconvolution
Deconvolution
 
디지털통신 9
디지털통신 9디지털통신 9
디지털통신 9
 
Basic plc
Basic plcBasic plc
Basic plc
 

Similar to Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET)

Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Anthony Dahanne
 
Container orchestration k8s azure kubernetes services
Container orchestration  k8s azure kubernetes servicesContainer orchestration  k8s azure kubernetes services
Container orchestration k8s azure kubernetes servicesRajesh Kolla
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Anthony Dahanne
 
Container Orchestration Integration: OpenStack Kuryr & Apache Mesos
Container Orchestration Integration: OpenStack Kuryr & Apache MesosContainer Orchestration Integration: OpenStack Kuryr & Apache Mesos
Container Orchestration Integration: OpenStack Kuryr & Apache MesosMidoNet
 
Container Orchestration Integration: OpenStack Kuryr
Container Orchestration Integration: OpenStack KuryrContainer Orchestration Integration: OpenStack Kuryr
Container Orchestration Integration: OpenStack KuryrTaku Fukushima
 
Kubernetes for Java developers
Kubernetes for Java developersKubernetes for Java developers
Kubernetes for Java developersRobert Barr
 
Pro2516 10 things about oracle and k8s.pptx-final
Pro2516   10 things about oracle and k8s.pptx-finalPro2516   10 things about oracle and k8s.pptx-final
Pro2516 10 things about oracle and k8s.pptx-finalMichel Schildmeijer
 
Clocker - How to Train your Docker Cloud
Clocker - How to Train your Docker CloudClocker - How to Train your Docker Cloud
Clocker - How to Train your Docker CloudAndrew Kennedy
 
Introducing Docker Swarm - the orchestration tool by Docker
Introducing Docker Swarm - the orchestration tool by DockerIntroducing Docker Swarm - the orchestration tool by Docker
Introducing Docker Swarm - the orchestration tool by DockerRamit Surana
 
Kubernetes fundamentals
Kubernetes fundamentalsKubernetes fundamentals
Kubernetes fundamentalsVictor Morales
 
Simulating Production with Clocker
Simulating Production with ClockerSimulating Production with Clocker
Simulating Production with ClockerAndrew Kennedy
 
DevNetCreate - ACI and Kubernetes Integration
DevNetCreate - ACI and Kubernetes IntegrationDevNetCreate - ACI and Kubernetes Integration
DevNetCreate - ACI and Kubernetes IntegrationHank Preston
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java OperatorAnthony Dahanne
 
Best Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBest Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBlueData, Inc.
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerAndrew Kennedy
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for BeginnersOktay Esgul
 

Similar to Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET) (20)

Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Container orchestration k8s azure kubernetes services
Container orchestration  k8s azure kubernetes servicesContainer orchestration  k8s azure kubernetes services
Container orchestration k8s azure kubernetes services
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 
Container Orchestration Integration: OpenStack Kuryr & Apache Mesos
Container Orchestration Integration: OpenStack Kuryr & Apache MesosContainer Orchestration Integration: OpenStack Kuryr & Apache Mesos
Container Orchestration Integration: OpenStack Kuryr & Apache Mesos
 
Container Orchestration Integration: OpenStack Kuryr
Container Orchestration Integration: OpenStack KuryrContainer Orchestration Integration: OpenStack Kuryr
Container Orchestration Integration: OpenStack Kuryr
 
Kubernetes for Java developers
Kubernetes for Java developersKubernetes for Java developers
Kubernetes for Java developers
 
Pro2516 10 things about oracle and k8s.pptx-final
Pro2516   10 things about oracle and k8s.pptx-finalPro2516   10 things about oracle and k8s.pptx-final
Pro2516 10 things about oracle and k8s.pptx-final
 
Clocker - How to Train your Docker Cloud
Clocker - How to Train your Docker CloudClocker - How to Train your Docker Cloud
Clocker - How to Train your Docker Cloud
 
Introducing Docker Swarm - the orchestration tool by Docker
Introducing Docker Swarm - the orchestration tool by DockerIntroducing Docker Swarm - the orchestration tool by Docker
Introducing Docker Swarm - the orchestration tool by Docker
 
Kubernetes fundamentals
Kubernetes fundamentalsKubernetes fundamentals
Kubernetes fundamentals
 
Simulating Production with Clocker
Simulating Production with ClockerSimulating Production with Clocker
Simulating Production with Clocker
 
DevNetCreate - ACI and Kubernetes Integration
DevNetCreate - ACI and Kubernetes IntegrationDevNetCreate - ACI and Kubernetes Integration
DevNetCreate - ACI and Kubernetes Integration
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java Operator
 
Best Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBest Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker Containers
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud Maker
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for Beginners
 
AKS components
AKS componentsAKS components
AKS components
 
2015 05-06-elias weingaertner-docker-intro
2015 05-06-elias weingaertner-docker-intro2015 05-06-elias weingaertner-docker-intro
2015 05-06-elias weingaertner-docker-intro
 

More from petabridge

NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxpetabridge
 
DotNext 2020 - When and How to Use the Actor Model and Akka.NET
DotNext 2020 - When and How to Use the Actor Model and Akka.NETDotNext 2020 - When and How to Use the Actor Model and Akka.NET
DotNext 2020 - When and How to Use the Actor Model and Akka.NETpetabridge
 
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka....NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...petabridge
 
Introduction to Distributed Tracing
Introduction to Distributed TracingIntroduction to Distributed Tracing
Introduction to Distributed Tracingpetabridge
 
Akka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the PainAkka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the Painpetabridge
 
Introduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.ClusterIntroduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.Clusterpetabridge
 
Automed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBenchAutomed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBenchpetabridge
 
We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...petabridge
 
The New .NET Enterprise Stack
The New .NET Enterprise StackThe New .NET Enterprise Stack
The New .NET Enterprise Stackpetabridge
 
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET ActorsFull-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET Actorspetabridge
 
OSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NETOSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NETpetabridge
 
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NETConcurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NETpetabridge
 
Syncromatics Akka.NET Case Study
Syncromatics Akka.NET Case StudySyncromatics Akka.NET Case Study
Syncromatics Akka.NET Case Studypetabridge
 
Akka.NET @ London.NET
Akka.NET @ London.NETAkka.NET @ London.NET
Akka.NET @ London.NETpetabridge
 
Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15petabridge
 
Slides - Intro to Akka.Cluster
Slides - Intro to Akka.ClusterSlides - Intro to Akka.Cluster
Slides - Intro to Akka.Clusterpetabridge
 
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)petabridge
 
Distributed Transactions in Akka.NET
Distributed Transactions in Akka.NETDistributed Transactions in Akka.NET
Distributed Transactions in Akka.NETpetabridge
 
Streaming ETL With Akka.NET
Streaming ETL With Akka.NETStreaming ETL With Akka.NET
Streaming ETL With Akka.NETpetabridge
 
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...petabridge
 

More from petabridge (20)

NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptx
 
DotNext 2020 - When and How to Use the Actor Model and Akka.NET
DotNext 2020 - When and How to Use the Actor Model and Akka.NETDotNext 2020 - When and How to Use the Actor Model and Akka.NET
DotNext 2020 - When and How to Use the Actor Model and Akka.NET
 
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka....NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
 
Introduction to Distributed Tracing
Introduction to Distributed TracingIntroduction to Distributed Tracing
Introduction to Distributed Tracing
 
Akka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the PainAkka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the Pain
 
Introduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.ClusterIntroduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.Cluster
 
Automed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBenchAutomed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBench
 
We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...
 
The New .NET Enterprise Stack
The New .NET Enterprise StackThe New .NET Enterprise Stack
The New .NET Enterprise Stack
 
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET ActorsFull-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
 
OSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NETOSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NET
 
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NETConcurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
 
Syncromatics Akka.NET Case Study
Syncromatics Akka.NET Case StudySyncromatics Akka.NET Case Study
Syncromatics Akka.NET Case Study
 
Akka.NET @ London.NET
Akka.NET @ London.NETAkka.NET @ London.NET
Akka.NET @ London.NET
 
Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15
 
Slides - Intro to Akka.Cluster
Slides - Intro to Akka.ClusterSlides - Intro to Akka.Cluster
Slides - Intro to Akka.Cluster
 
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
 
Distributed Transactions in Akka.NET
Distributed Transactions in Akka.NETDistributed Transactions in Akka.NET
Distributed Transactions in Akka.NET
 
Streaming ETL With Akka.NET
Streaming ETL With Akka.NETStreaming ETL With Akka.NET
Streaming ETL With Akka.NET
 
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
 

Recently uploaded

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Recently uploaded (20)

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET)

  • 1. Continuous Deployment with Akka.Cluster and Kubernetes By Aaron Stannard, Petabridge CEO Akka.NET Co-Founder
  • 2. What We’re Going to Learn Today • Akka.Cluster Overview • Docker & .NET Core Fundamentals • Akka.Cluster & Docker Best Practices • Kubernetes Concepts • Azure Kubernetes Service • Putting it all Together into Continuous Deployment
  • 3. Why .NET Core? • Cross-platform • Extremely fast • Lightweight • Future of .NET • Plays well with Docker
  • 4. Why Docker? • Ubiquitous – runs everywhere, used everywhere. • Easy, reproducible configuration format – Dockerfiles. • Composable. • Easy to share output via compiled Docker images.
  • 5. Why Kubernetes? • Ubiquitous – runs on- premise, on the cloud, etc… • Robust deployment models – including handling for stateful apps. • Rich ecosystem.
  • 6. Why Azure Kubernetes Service? • Takes only a few minutes to setup. • Integrates well with Azure DevOps. • Great environment for learning K8s.
  • 9. View of an Akka.NET Cluster Each node is its own ActorSystem
  • 10.
  • 11. How Akka.Cluster State Gets Distributed: Routers
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Other State Distribution Tools • Akka.Cluster.Tools – Distributed Publish-Subscribe – ClusterClient • Akka.Cluster.Sharding
  • 19. Working with .NET Core, Akka.NET, and Docker
  • 20. Docker Key Terms • “Image” – a compiled image containing all of the files needed to execute the process. • “Repository” – a collection of named and tagged images hosted at a specific URI. • “Container” – represents a running instance of a Docker image on a host machine. • “Host” – a machine running the Docker engine, capable of hosting 1 or more running containers.
  • 23. Bootstrapping Akka.Cluster • Need to program Akka.Remote to automatically listen to reachable host + port inside Docker vNet. • Need to program Akka.Cluster to contact seed nodes inside Docker vNet. • Need to program Akka.Cluster to leave cluster gracefully prior to / during container shutdown.
  • 24. Akka.Bootstrap.Docker PackageCalls Akka.Bootstrap.Docker parser – injects runtime & environment networking values directly into HOCON prior to starting ActorSystem. 1. If CLUSTER_IP environment variable is set, that becomes akka.remote.dot- netty.tcp.public-hostname. If not, then Dns.GetHostName() is used. 2. CLUSTER_PORT environment variable is used for dot-netty.tcp.port. 3. CLUSTER_SEEDS environment variable is a comma-delimited list of addresses.
  • 25. Akka.NET Dockerfile FROM microsoft/dotnet:2.1-sdk AS base WORKDIR /app # should be a comma-delimited list ENV CLUSTER_SEEDS "[]" ENV CLUSTER_IP "" ENV CLUSTER_PORT "5213" #Akka.Remote inbound listening endpoint EXPOSE 5213 COPY ./bin/Release/netcoreapp2.1/publish/ /app # Install Petabridge.Cmd client RUN dotnet tool install --global pbm # Needed because https://stackoverflow.com/questions/51977474/install-dotnet-core-tool- dockerfile ENV PATH="${PATH}:/root/.dotnet/tools" # RUN pbm help CMD ["dotnet", "WebCrawler.CrawlService.dll"] Name of the base image we’re going to use. Taken from the public Microsoft .NET Core repository on DockerHub Set of environment variables expected by Akka.Bootstrap.Docker The container’s port expose to the Docker network Copy application files from host machine to container working directory Execute command inside container Container’s process entrypoint. If this process dies, the container dies.
  • 26. Using Petabridge.Cmd Inside Docker • Provides instrumentation to managing, viewing cluster from inside Docker network. • Can be used to trigger graceful shutdowns of containers. • Secured inside container network – have to be able to access host machine to invoke pbm.
  • 28. Private Docker Registries • Don’t publish your company’s code onto DockerHub. • Use Azure Container Registry (ACR) or private hosts or services instead.
  • 29. Kubernetes Core Concepts • K8s is an “orchestration” platform – networks multiple container hosts together into unified abstraction. • Applications are deployed to the K8s cluster – K8s then orchestrates the instantiation of containers across hosts. • Applications define via configuration: – Which parts can be exposed publicly and how. – How different parts of application can be deployed and managed.
  • 32. K8s Key Terms (for Akka.Cluster) • “Pod” – represents a single application unit of execution. Consists of 1 or more Docker container. • “Stateful set” – a deployment group of identical pods working together as a stateful service. • “Service” – defines how a stateful set exposes itself to other services within K8s and Akka.NET cluster.
  • 33.
  • 34. Akka.Cluster K8s Methodology • All applications are deployed as stateful sets – State is fundamental to how Akka.Cluster works • All internal Akka.Cluster functionality is exposed as “ClusterIp” services • External / public functionality can exposed as a “LoadBalancer” service or otherwise • Petabridge.Cmd used for node exits • Deployments / rollbacks performed by
  • 35. K8s Stateful Set YAML File (pt1) apiVersion: apps/v1 kind: StatefulSet metadata: name: lighthouse labels: app: lighthouse spec: serviceName: lighthouse replicas: 3 selector: matchLabels: app: lighthouse template: metadata: labels: app: lighthouse spec: terminationGracePeriodSeconds: 35 containers: - name: lighthouse image: webcrawler.lighthouse:0.2.4 lifecycle: preStop: exec: command: ["/bin/sh", "-c", "pbm 127.0.0.1:9110 cluster leave"] Declares “lighthouse” stateful set Declares number of replicas in initial deployment Specifies the container name inside the pod and the Docker image used. Tells K8s to invoke this command prior to Terminating any pods in this stateful set.
  • 36. K8s Stateful Set YAML File (pt2) env: - name: ACTORSYSTEM value: webcrawler - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: CLUSTER_IP value: "$(POD_NAME).lighthouse" - name: CLUSTER_SEEDS value: akka.tcp://webcrawler@lighthouse-0.lighthouse:4053,akka.tcp://webcrawler@lighthouse- 1.lighthouse:4053,akka.tcp://webcrawler@lighthouse-2.lighthouse:4053 livenessProbe: tcpSocket: port: 4053 ports: - containerPort: 4053 protocol: TCP Populates the POD_NAME environment variable using K8s metadata at deployment time. Populates unique per-node hostname consumed by Akka.Bootstrap.Docker. Seed nodes Liveness probe. Terminates + restarts container if this check fails. Using Akka.Remote inbound port. Container port – exposed to internal K8s network.
  • 37. K8s ClusterIP Service YAML apiVersion: v1 kind: Service metadata: name: lighthouse labels: app: lighthouse spec: clusterIP: None ports: - port: 4053 selector: app: lighthouse Exposes Lighthouse services across-hosts on their container port (4053) and host IP addresses. Not accessible outside of K8s cluster. Tells K8s that this service points to the “lighthouse” stateful set we deployed earlier.
  • 38. Creating the Initial K8s Cluster kubectl apply –f k8s-lighthouse-service.yaml kubectl apply –f k8s-crawler-service.yaml kubectl apply –f k8s-web-service.yaml Etc…
  • 39. Azure Kubernetes Service (AKS) • Managed K8s on top of Azure virtual machines and other resources. • Easy to setup and instrument – Azure CLI makes it easy to communicate with AKS via kubectl. – Works well with Azure DevOps. – Dev Spaces make it easy to work across multiple people & teams. • Great environment for learning K8s.
  • 41. Links and Further Reading • Source: https://github.com/petabridge/Cluster.WebCrawler • Petabridge.Cmd: https://cmd.petabridge.com/ • Akka.Bootstrap.Docker: https://github.com/petabridge/akkadotnet-bootstrap • Akka.HealthCheck.Cluster: https://github.com/petabridge/akkadotnet- healthcheck • AKS Quickstart Tutorial: https://docs.microsoft.com/en-us/azure/aks/tutorial- kubernetes-prepare-app • AKS + kubectl CLI Tutorial: https://docs.microsoft.com/en- us/azure/aks/kubernetes-walkthrough • Akka.Cluster, Docker, K8s Training Tour: https://trainingtour2019.petabridge.com/