Skip to main content

Migration Example: VM to Kubernetes

Quick Summary - Migrate VMs to Kubernetes in days, not months. Design your topology in Stacktic → everything else is automated.


Table of Contents

  1. Chapter 1: Overview
  2. Chapter 2: Why Migrate?
  3. Chapter 3: Why Stacktic?
  4. Chapter 4: How It Works
  5. Chapter 5: Complete Migration Example
  6. Next Steps

Chapter 1: Overview

This guide walks through a real-world VM-to-Kubernetes migration using Stacktic. We'll take a traditional VM-based application stack and migrate it to a modern, cloud-native Kubernetes environment with minimal effort and maximum automation.

Migration Timeline

Traditional ApproachWith Stacktic
3-6 months manual workDays to weeks automated
Complex YAML configurationsVisual topology design
Manual networking setupAuto-generated manifests
Security configured afterSecurity built-in from start

What You'll Learn

  • Design your Kubernetes topology in Stacktic (replicate your VM architecture)
  • Migrate code and data dumps (containerization and data migration)
  • Modernize with observability, security, and GitOps

The Migration Process (Visual Overview)


Chapter 2: Why Migrate?

VM vs Kubernetes Comparison

BenefitVMsKubernetes
Cost20-30% utilization, over-provisioned60-80% utilization = 40-60% cost savings
ScalingManual, slowAutomatic, instant
Deployment & OperationHours/daysMinutes
HA/DR2x-3x duplicate infrastructureBuilt-in replicas and auto-scaling
Modern TechOld, legacyAdoptable, secure, revenue driven

Chapter 3: Why Stacktic?

Traditional migration: Each app = months of manual work and planning With Stacktic: Design once → Everything auto-generated

Time Comparison

AppsTraditionalStackticSavings
5 apps10-20 months2-4 weeks90% faster
10 apps20-40 months4-8 weeks90% faster
20 apps3-7 years2-4 months90% faster

Chapter 4: How It Works

Migration in 3 Steps

StepWhat You DoTime
1. MapList VMs, services, connections, versions1-2 days
2. DesignDrag components in Stacktic → Draw connections → Click "Generate"4-8 hours
3. DeployContainerize apps → Migrate data → Deploy to production1-3 days

Total: 3-7 days per application


What You Get

Click "Generate" → Stacktic creates:

  • Kubernetes manifests (Deployments, Services, StatefulSets)
  • Security (RBAC, NetworkPolicy, secrets encryption)
  • Connections (Secrets, ConfigMaps, DNS, env vars)
  • Monitoring (Prometheus, Grafana)
  • Multi-environment configs (dev/staging/prod)
  • Documentation

Chapter 5: Complete Migration Example

This is YOUR VM Infrastructure - Below is a real-world example showing a traditional VM-based data center. We'll show you exactly how to migrate it to Kubernetes in 3 simple steps.


The Application Before Migration

Traditional VM-Based Data Center Infrastructure:


VM Architecture Components

Your current VM infrastructure:

ComponentTypeDetails
Python App VMApplication ServerPython microservice running on dedicated VM
Spring App VMApplication ServerSpring Boot application on separate VM
PostgreSQL VMDatabase ServerPrimary relational database
MongoDB VMsDatabase ClusterSharded MongoDB cluster across multiple VMs
RabbitMQ VMMessage QueueMessage broker for async processing
Load BalancerNetworkHardware load balancer
FirewallNetworkManual firewall rules between VMs

Challenges with this architecture:

  • Each VM over-provisioned (20-30% utilization)
  • Manual configuration and networking
  • Slow scaling (hours to provision new VMs)
  • High operational overhead
  • No automated deployments

Migration Journey

Here's How We'll Migrate This:

StepWhat You DoStacktic Does For YouResultTime
1. Design Topology• Map VMs to K8s components
• Drag & drop in Stacktic UI
• Draw connections
• Click "Generate"
• Auto-generates all manifests
• Creates NetworkPolicies
• Sets up RBAC & secrets
• Configures service mesh
All infrastructure code ready4-8 hours
2. Import Code & Data• Provide source code & repos
• Export database dumps from VMs
Stacktic AI dockerizes your apps
• Generates Dockerfiles & CI/CD
Assists with data migration
• Creates import scripts
Apps containerized, data migrated1-2 days
3. Add SRE/SecOps• Select tools from Stacktic catalog
• Connect monitoring & security
• Auto-configures Prometheus/Grafana
• Sets up Trivy & OPA policies
• Integrates ArgoCD GitOps
• Configures Keycloak auth
Production-ready stack2-4 hours

Total Migration Time: 3-5 days (vs. 3-6 months traditional approach)


Let's walk through each step in detail:


Step 1: Design Topology in Stacktic

Map your VM components to Kubernetes:

From VMTo Kubernetes Component
Python App VMPython application (containerized)
Spring App VMSpring application (containerized)
PostgreSQL VMPostgreSQL database (CNPG)
MongoDB VMsMongoDB cluster (sharded)
RabbitMQ VMRabbitMQ messaging
Load BalancerAPI Gateway (APISIX)
FirewallNetworkPolicies (auto-generated)

Design in Stacktic (drag & drop):

alt text

What you see:

  • python - Python application (from VM)
  • spring - Spring application (from VM)
  • db + cnpg - PostgreSQL database
  • mongo_db + shard + stage + mongodb - MongoDB cluster
  • rabbitmq + exchange + queue - RabbitMQ messaging
  • apisixpython - API gateway routing
  • apisixopensearch - Log routing

At this point: You've designed your basic application topology. Stacktic will generate all manifests, connections, secrets, and networking.


Step 2: Migrate Code and Data Dumps

Dockerize Your Applications

Option 1: Automated VM to Container Conversion

Stacktic provides an automated end-to-end solution to convert VMs to containers:

Option 2: Bring Your Own Docker Images

If you prefer manual control or already have containers:

  • Use your existing Dockerfiles
  • Import pre-built images from your registry
  • Stacktic integrates with any container registry (Docker Hub, ECR, GCR, etc.)

Import Data to Kubernetes

Stacktic Assists with Data Migration:

For PostgreSQL:

# Export from VM
pg_dump -h old-vm -U postgres prod > prod_backup.dump

kubectl exec -i -n cnpg cluster-cnpg-1 -- pg_restore -U postgres -d prod --clean --if-exists --no-owner --no-acl < prod_backup.dump

For MongoDB:

  • Stacktic provides migration scripts for sharded clusters
  • Handles data replication and validation
  • Ensures zero-downtime migration strategies

At this point: Your application code is containerized (by Stacktic AI or manually) and your data is migrated into the new Kubernetes environment with Stacktic's assistance.


Step 3: Add Modern Capabilities

Add monitoring, security, GitOps:

alt text

Added: Prometheus, Grafana, Trivy, ArgoCD, Keycloak, OPA, K6

Result: Same apps + modern observability, security, GitOps → All auto-configured


Next Steps

Ready to migrate?

Contact: support@stacktic.io for migration planning and architecture review