Rails Scale with Kubernetes
Submitted by Rahul Mahale (@rahulmahale) on Monday, 26 February 2018
Technical level: Intermediate Status: Under evaluation
There are lots of different ways to deploy/provision Rails Apps: Capistrano, Chef, Ansible, Fabric or using Heroku, EngineYard, etc. Kubernetes, a container orchestration tool, as an alternative to traditional Rails deployment tools, can be rewarding at scale.
Deploying a Rails app on kubernetes and making it ready for production isn’t that straightforward though. Let’s dive into the details and we will see how to automate Rails deployments on Kubernetes
We will explore how Kubernetes has been helping us at scale deployments, with savings on various metrics.
Last year we started building an automated Rails deployment tool on top of Kubernetes(planned to be open-sourced in future).
In this session, we will discuss our experiences and hurdles about the same, and build a generic Rails deployer on top of Kubernetes.
We will start by discussing how to deploy a Rails app on Kubernetes cluster and do rolling deployments. We will do a walk through the sample Rails app “wheel” and how to deploy it on Kubernetes.
We will talk in detail about:
- Automatically building docker image for each commit.
- Writing/modifying deployment templates for applications.
- Grouping the app in different pods (web, background, etc.).
- How to handle db:migrate, db:seed, etc tasks to run once in deployment flow.
- Managing environment variables using Kubernetes Secrets
- Ability to tweak some configurations such as Sidekiq queues using Kubernetes ConfigMaps.
- Using persistent volume to store persistent data
- Zero downtime deployment on rolling deployments.
- Use of Ingress controllers to loadbalance and route the application traffic.
- Handling Graceful shutdown of processes.
- Horizontal and virtical autoscaling of applications.
- Monitoring applications.
This talk details about the containerization of rails application and how the deployment process speeds up with containerization.
We will also do a comparison of before/after moving from server architecture to kubernetes deployments, and how we are saving on time and resources when scaling up/down our resources.
Vipul is Director at BigBinary. He is part of Rails Team, and helps triaging issues.
His spare time is spent exploring and contributing to many Open Source ruby projects, when not dabbling with React JS or Kubernetes. Recently he authored ReactJS by Example, that does a deep walk-through of using ReactJS.
Vipul loves Ruby’s vibrant community and helps in building PuneRb. He also organizes DeccanRubyConf in Pune.
He helps in editing Rails-weekly and AllThingsDevops podcast.
A Open-Source Enthusiast, Currently working as Senior DevOps Engineer at BigBinary.
Strong believer of Infrastructure-as-a-code principal.Proficient in automating stuffs using Chef, Ansible and Terraform and usually uses Scripting languages like Bash, Ruby and Python.Recently working mostly on Containers and orchestration of containers in the Cloud environments and proficient in implementing Kubernetes Clusters. Hosts “All Things DevOps Podcast”. Loves attending and Speaking at Technical conferences. Organizes Digital Ocean Pune group and actively involved in Kubernetes/Docker Pune meetups.