Python, Docker, Kubernetes, Python, Docker, Kubernetes, and beyond? - - PowerPoint PPT Presentation

python docker kubernetes python docker kubernetes and
SMART_READER_LITE
LIVE PREVIEW

Python, Docker, Kubernetes, Python, Docker, Kubernetes, and beyond? - - PowerPoint PPT Presentation

Python, Docker, Kubernetes, Python, Docker, Kubernetes, and beyond? and beyond? Peter Bbics Peter Bbics | EuroPython 2018 EuroPython 2018 July 25, 2018 July 25, 2018 Based in Prague Small team of developers Developing a trading


slide-1
SLIDE 1

Python, Docker, Kubernetes, Python, Docker, Kubernetes, and beyond? and beyond?

Peter Bábics Peter Bábics | EuroPython 2018 EuroPython 2018

July 25, 2018 July 25, 2018

slide-2
SLIDE 2

Based in Prague Small team of developers Developing a trading platform and strategies Using open source

slide-3
SLIDE 3

Our trading platform and tooling Our trading platform and tooling

Python 3.6 + React.js asyncio Redis & TimescaleDB for storage Integrating third party libraries using Cython Dozens of processes Messaging - Kafka / RabbitMQ

slide-4
SLIDE 4

In the beginning In the beginning

There was chaos There was chaos

slide-5
SLIDE 5

In the beginning In the beginning

Applications deployed on physical servers Managed by circus Packages installed in virtualenv Under a single user

slide-6
SLIDE 6

Pros Pros

Simple implementation and deployment

Cons Cons

Package versioning hell No failover

slide-7
SLIDE 7

A wild blue whale appeared A wild blue whale appeared

slide-8
SLIDE 8

The promise of a brighter future The promise of a brighter future

Unified environment Simple deployment Simple migrations Faster Continuous Integration (CI) Atomic releases

slide-9
SLIDE 9

Migration challenges Migration challenges

Image storage - GitLab registry Image caching Dedicated building environment CI pipeline design Cleaning up old images

build_job: script:

  • docker build -t $CI_IMAGE_NAME .

build_job: script:

  • 'docker run -d -p 9000:9000 -v "/:/data" sleep 1y'
slide-10
SLIDE 10

Migration highlights Migration highlights

Unified, stable environment Fast builds Isolated environments Faster CI pipeline

slide-11
SLIDE 11
slide-12
SLIDE 12

Cons of plain Docker Cons of plain Docker

Known bugs No failover dockerd is a single point of failure

slide-13
SLIDE 13

Docker gotchas Docker gotchas

PID 1 pitfall User permissions within containers

slide-14
SLIDE 14

Ahoy! Ahoy!

slide-15
SLIDE 15

Warmly welcomed features Warmly welcomed features

Failover when a server fails Configuration stored in namespaces Service discovery Ingress controller Deployment history

my-service.my-namespace.svc.cluster.local $ kubectl rollout undo deployment my-app

slide-16
SLIDE 16

Where we are now Where we are now

Migration to Kubernetes is in progress Environment is configured by namespace variables Deployments are described in Jinja2 templates

{% set env_type, profile_name = PROFILE.split('_', 1) %} {% set namespace = "my-ns-" + env_type %} {% set data_directory_mount = '/data' %} {% if profile_name == 'cthulu' %}

  • name: API_KEY

valueFrom: secretKeyRef: name: secret key: api_key

  • name: SUBSCRIPTION_INSTRUMENT_FILTER

value: 'False' {% endif %}

slide-17
SLIDE 17

Notable features Notable features

Probes Update strategies

slide-18
SLIDE 18

Update strategies - Rolling update Update strategies - Rolling update

slide-19
SLIDE 19

Update strategies - Recreate Update strategies - Recreate

slide-20
SLIDE 20

Thank you Thank you

peter.babics@ peter.babics@quantlane.com quantlane.com github.com/qntln github.com/qntln