Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying and Managing Python with Kubernetes by Joannah Nanjekye

Pycon ZA
October 11, 2018

Deploying and Managing Python with Kubernetes by Joannah Nanjekye

Because of the benefits of containers, python applications have been containerized recently. Containers have magically changed the way we deploy and manage python applications allowing us to build, develop, test, and even deploy python applications on a single system with no upgrade downtimes.

Kubernetes is the missing layer that gives us the ability to manage many containers by providing features that enable containers to scale, talk to each other and work in harmony.

This talk will focus on how python developers can leverage Kubernetes to manage any sort of python application on Kubernetes from simple to complex applications.

The talk will cover:

- The basics of Kubernetes.
- The basics of containerizing python applications.
- How to run and deploy simple, web and deep learning python pipelines on Kubernetes.
- How to manage or work with Kubernetes using the Kubernetes python client.

This talk will cover in summary the topics I talk about in my upcoming book "Deploying and Managing Python with Kubernetes" published by Apress sometime this year.

Pycon ZA

October 11, 2018
Tweet

More Decks by Pycon ZA

Other Decks in Technology

Transcript

  1. About Me • Software Engineer • Aeronautical Engineer to be!

    • Open Sourcerer • Author • Upcoming UNB Grad to work on some pypy stuff <> IBM
  2. Virtualize the OS • Run a container runtime on host

    operating system. • Better performance due to absence of guest operating systems
  3. For a simple app from flask import Flask app =

    Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run(host='0.0.0.0')
  4. Dockerfile FROM gliderlabs/alpine:3.2 RUN apk-install python COPY requirements.txt . RUN

    apk --update add --virtual build-dependencies py-pip \ && pip install -r requirements.txt \ && apk del build-dependencies COPY . /code WORKDIR /code EXPOSE 5000 ENTRYPOINT ["python", "myapp.py"]
  5. Summary • Containers are a packaging for applications. • Giving

    us portability, increased productivity and scaling. • Create a container by creating a Dockerfile, build the image using instructions from this file, and run it to start the container.
  6. The last mile! • What happens when we have many

    containers? • How do we monitor them? • What about Scaling ?
  7. Deployment • Specify an image from which to create a

    container. • Deployment criteria i.e RAM, CPU, storage
  8. Deploying Python App to Kubernetes Key Requirements • A container

    image for your application. • A deployment. • A service to expose your deployment
  9. Rolling Updates Pass a new image name and tag with

    the --image flag and (optionally) a new controller name kubectl rolling-update NAME [NEW_NAME] --image=IMAGE:TAG For zero upgrade downtimes