Services

Accelerators

Resources

Company

Services

Accelerators

Resources

Company

Cover illustration for the case study: Moving 25+ VMs to Kubernetes with zero downtime

Case study

Case study

Flip.id logo

/

/

Flip.id

Flip.id

Moving 25+ VMs to Kubernetes with zero downtime

Moving 25+ VMs to Kubernetes with zero downtime

Moving 25+ VMs to Kubernetes with zero downtime

Moving 25+ VMs to Kubernetes with zero downtime

We moved Flip’s 25+ Alibaba Cloud VMs, serving peaks of 25,000 requests a second, to managed Kubernetes with autoscaling and no downtime.

We moved Flip’s 25+ Alibaba Cloud VMs, serving peaks of 25,000 requests a second, to managed Kubernetes with autoscaling and no downtime.

We moved Flip’s 25+ Alibaba Cloud VMs, serving peaks of 25,000 requests a second, to managed Kubernetes with autoscaling and no downtime.

Cover illustration for the case study: Moving 25+ VMs to Kubernetes with zero downtime

The results

The results

The results

30%

30%

Lower compute cost

Lower compute cost

30%

Lower compute cost

120

120

120

Pods at peak load

Pods at peak load

Pods at peak load

3 weeks

3 weeks

3 weeks

To move all traffic

To move all traffic

To move all traffic

One2N helped us when we had no SRE team. They set up an OKR to reduce my on-call time to zero. They fixed all our burning problems one by one and also set up processes and best practices. They are not just a DevOps team, they are strong software craftspeople, working with our dev team to brainstorm architectural decisions.

One2N helped us when we had no SRE team. They set up an OKR to reduce my on-call time to zero. They fixed all our burning problems one by one and also set up processes and best practices. They are not just a DevOps team, they are strong software craftspeople, working with our dev team to brainstorm architectural decisions.

One2N helped us when we had no SRE team. They set up an OKR to reduce my on-call time to zero. They fixed all our burning problems one by one and also set up processes and best practices. They are not just a DevOps team, they are strong software craftspeople, working with our dev team to brainstorm architectural decisions.

Luqman Sungkar

Luqman Sungkar

CTO, Flip.id

CTO, Flip.id

The context

The context

Flip is a fintech company in Indonesia. Its stateless backend services ran on 25+ VMs in Alibaba Cloud, each running Nginx and PHP-FPM, with traffic routed through Cloudflare.

Those services carried Flip’s B2B and B2C traffic, which often peaked at 25,000 requests a second. The SRE team scaled the VMs by hand to keep up.

Flip is a fintech company in Indonesia. Its stateless backend services ran on 25+ VMs in Alibaba Cloud, each running Nginx and PHP-FPM, with traffic routed through Cloudflare.

Those services carried Flip’s B2B and B2C traffic, which often peaked at 25,000 requests a second. The SRE team scaled the VMs by hand to keep up.

The challenge

The challenge

Manual scaling at peak: 25+ VMs were scaled by hand, so traffic spikes meant high latency and, at times, gateway timeouts.

Manual scaling at peak: 25+ VMs were scaled by hand, so traffic spikes meant high latency and, at times, gateway timeouts.

Manual scaling at peak: 25+ VMs were scaled by hand, so traffic spikes meant high latency and, at times, gateway timeouts.

Configuration toil: Nginx and PHP-FPM ran tightly coupled on every VM, which made configuration changes slow and risky.

Configuration toil: Nginx and PHP-FPM ran tightly coupled on every VM, which made configuration changes slow and risky.

Configuration toil: Nginx and PHP-FPM ran tightly coupled on every VM, which made configuration changes slow and risky.

The impact

The impact

Zero downtime: The three-month migration finished with no downtime or business impact.

Zero downtime: The three-month migration finished with no downtime or business impact.

Zero downtime: The three-month migration finished with no downtime or business impact.

Zero downtime: The three-month migration finished with no downtime or business impact.

30% lower compute cost: Autoscaling now scales down by 70% outside peak hours.

30% lower compute cost: Autoscaling now scales down by 70% outside peak hours.

30% lower compute cost: Autoscaling now scales down by 70% outside peak hours.

30% lower compute cost: Autoscaling now scales down by 70% outside peak hours.

Maintainable config: Complex Nginx rules now live in Kubernetes Ingress resources.

Maintainable config: Complex Nginx rules now live in Kubernetes Ingress resources.

Maintainable config: Complex Nginx rules now live in Kubernetes Ingress resources.

Maintainable config: Complex Nginx rules now live in Kubernetes Ingress resources.

The approach

The approach

The existing setup consisted of web and mobile apps accessing backend APIs running on Alibaba Cloud VMs. The user traffic was routed via Cloudflare. Each VM had Nginx and PHP-FPM processes. The SRE team managed the scaling of infra to serve the traffic accordingly.

Diagram: Existing VM based setup
Existing VM based setup

Making the application cloud native.

  1. We started with containerizing the application. We separated the tightly coupled Nginx and PHP-FPM processes into separate stateless containers. One backend service used a sticky session, so we worked with the dev team to make it stateless.

  2. We migrated the existing Nginx configuration and routing rules to a ConfigMap in Kubernetes. We used the PHP container as Sidecar to Nginx in the same pod and mounted the ConfigMap.

  3. We also introduced ConfigMap reloader to detect config changes and automatically reload the application without downtime. This saved us operational overhead.

  4. From the security perspective, we adopted cloud-native secrets management and restricted access to the SRE team in production.

  5. Flip being a Fintech, reliability is of utmost priority. We updated the Continuous Deployment process to do Canary and controlled rollout to production. That way, we could detect errors before they impact all users.

  6. The cloud-native architecture allowed us to quickly set up observability tools to provide better visibility into operations. We also used the Kubernetes Horizontal Pod Autoscaler (HPA) to automate the scaling in/out of the Pods based on the traffic reducing the operation toil. So overall system looked as below.

Diagram: Application setup on kubernetes
Application setup on Kubernetes

Gradual traffic movement from VMs to Kubernetes.

We ran the VM and Kubernetes setups side by side and moved traffic across in stages, so users never felt the switch.

  • The deployment pipeline shipped every release to both setups, so the product team kept shipping new features throughout the migration.

  • Flip already used Cloudflare for DNS and DDoS protection, so we used Cloudflare’s External Load Balancer to split traffic between the two.

  • We started by routing 10% of live traffic to Kubernetes and watched RED metrics to make sure we stayed within the SLO.

  • Within 3 weeks, all traffic was on Kubernetes and we decommissioned the VMs. There was no business impact along the way.

Diagram: Phased rollout using Cloudflare external load balancer
Phased rollout using Cloudflare external load balancer

Managing the reliability at scale.

Before the move, sudden peaks in load often pushed latency up, sometimes far enough to cause gateway timeouts and hurt the business. Scaling VMs by hand was slow and error-prone, and a new VM took a long time to be ready for traffic.

  • The Horizontal Pod Autoscaler (HPA) now scales the app down by 70% outside peak hours, which cut compute costs by 30%.

  • When load goes up, HPA adds capacity on its own, without anyone scaling it by hand.

  • At peak load, we saw the deployment run 120 pods.

Tech stack used.

Component

Technology

Cloud provider

Alibaba Cloud

Container orchestration

Kubernetes

DNS and load balancing

Cloudflare

The existing setup consisted of web and mobile apps accessing backend APIs running on Alibaba Cloud VMs. The user traffic was routed via Cloudflare. Each VM had Nginx and PHP-FPM processes. The SRE team managed the scaling of infra to serve the traffic accordingly.

Diagram: Existing VM based setup
Existing VM based setup

Making the application cloud native.

  1. We started with containerizing the application. We separated the tightly coupled Nginx and PHP-FPM processes into separate stateless containers. One backend service used a sticky session, so we worked with the dev team to make it stateless.

  2. We migrated the existing Nginx configuration and routing rules to a ConfigMap in Kubernetes. We used the PHP container as Sidecar to Nginx in the same pod and mounted the ConfigMap.

  3. We also introduced ConfigMap reloader to detect config changes and automatically reload the application without downtime. This saved us operational overhead.

  4. From the security perspective, we adopted cloud-native secrets management and restricted access to the SRE team in production.

  5. Flip being a Fintech, reliability is of utmost priority. We updated the Continuous Deployment process to do Canary and controlled rollout to production. That way, we could detect errors before they impact all users.

  6. The cloud-native architecture allowed us to quickly set up observability tools to provide better visibility into operations. We also used the Kubernetes Horizontal Pod Autoscaler (HPA) to automate the scaling in/out of the Pods based on the traffic reducing the operation toil. So overall system looked as below.

Diagram: Application setup on kubernetes
Application setup on Kubernetes

Gradual traffic movement from VMs to Kubernetes.

We ran the VM and Kubernetes setups side by side and moved traffic across in stages, so users never felt the switch.

  • The deployment pipeline shipped every release to both setups, so the product team kept shipping new features throughout the migration.

  • Flip already used Cloudflare for DNS and DDoS protection, so we used Cloudflare’s External Load Balancer to split traffic between the two.

  • We started by routing 10% of live traffic to Kubernetes and watched RED metrics to make sure we stayed within the SLO.

  • Within 3 weeks, all traffic was on Kubernetes and we decommissioned the VMs. There was no business impact along the way.

Diagram: Phased rollout using Cloudflare external load balancer
Phased rollout using Cloudflare external load balancer

Managing the reliability at scale.

Before the move, sudden peaks in load often pushed latency up, sometimes far enough to cause gateway timeouts and hurt the business. Scaling VMs by hand was slow and error-prone, and a new VM took a long time to be ready for traffic.

  • The Horizontal Pod Autoscaler (HPA) now scales the app down by 70% outside peak hours, which cut compute costs by 30%.

  • When load goes up, HPA adds capacity on its own, without anyone scaling it by hand.

  • At peak load, we saw the deployment run 120 pods.

Tech stack used.

Component

Technology

Cloud provider

Alibaba Cloud

Container orchestration

Kubernetes

DNS and load balancing

Cloudflare

The existing setup consisted of web and mobile apps accessing backend APIs running on Alibaba Cloud VMs. The user traffic was routed via Cloudflare. Each VM had Nginx and PHP-FPM processes. The SRE team managed the scaling of infra to serve the traffic accordingly.

Diagram: Existing VM based setup
Existing VM based setup

Making the application cloud native.

  1. We started with containerizing the application. We separated the tightly coupled Nginx and PHP-FPM processes into separate stateless containers. One backend service used a sticky session, so we worked with the dev team to make it stateless.

  2. We migrated the existing Nginx configuration and routing rules to a ConfigMap in Kubernetes. We used the PHP container as Sidecar to Nginx in the same pod and mounted the ConfigMap.

  3. We also introduced ConfigMap reloader to detect config changes and automatically reload the application without downtime. This saved us operational overhead.

  4. From the security perspective, we adopted cloud-native secrets management and restricted access to the SRE team in production.

  5. Flip being a Fintech, reliability is of utmost priority. We updated the Continuous Deployment process to do Canary and controlled rollout to production. That way, we could detect errors before they impact all users.

  6. The cloud-native architecture allowed us to quickly set up observability tools to provide better visibility into operations. We also used the Kubernetes Horizontal Pod Autoscaler (HPA) to automate the scaling in/out of the Pods based on the traffic reducing the operation toil. So overall system looked as below.

Diagram: Application setup on kubernetes
Application setup on Kubernetes

Gradual traffic movement from VMs to Kubernetes.

We ran the VM and Kubernetes setups side by side and moved traffic across in stages, so users never felt the switch.

  • The deployment pipeline shipped every release to both setups, so the product team kept shipping new features throughout the migration.

  • Flip already used Cloudflare for DNS and DDoS protection, so we used Cloudflare’s External Load Balancer to split traffic between the two.

  • We started by routing 10% of live traffic to Kubernetes and watched RED metrics to make sure we stayed within the SLO.

  • Within 3 weeks, all traffic was on Kubernetes and we decommissioned the VMs. There was no business impact along the way.

Diagram: Phased rollout using Cloudflare external load balancer
Phased rollout using Cloudflare external load balancer

Managing the reliability at scale.

Before the move, sudden peaks in load often pushed latency up, sometimes far enough to cause gateway timeouts and hurt the business. Scaling VMs by hand was slow and error-prone, and a new VM took a long time to be ready for traffic.

  • The Horizontal Pod Autoscaler (HPA) now scales the app down by 70% outside peak hours, which cut compute costs by 30%.

  • When load goes up, HPA adds capacity on its own, without anyone scaling it by hand.

  • At peak load, we saw the deployment run 120 pods.

Tech stack used.

Component

Technology

Cloud provider

Alibaba Cloud

Container orchestration

Kubernetes

DNS and load balancing

Cloudflare

Download this case study

Download this case study

A PDF version to read later or share with your team.

A PDF version to read later or share with your team.

Facing a similar problem?

Facing a similar problem?

Talk to the engineers who did this work at one2n.io/contact

Talk to the engineers who did this work at one2n.io/contact

Facing a similar problem?

Facing a similar problem?

Facing a similar problem?

Book a 30-minute call with the engineers who did this work. Bring your system and we’ll tell you what we’d try first.

Book a 30-minute call with the engineers who did this work. Bring your system and we’ll tell you what we’d try first.

More case studies

More case studies

Latest from the blog

Latest from the blog