Professional Documents
Culture Documents
Delusion or Reality?
Kunal Kushwaha
NTT Open Source Software Center
kernel
VM Platform VM Platform
https://dzone.com/guides/containers-orchestration-and-beyond
kernel
VM Platform
• The lift and shift migration approach is about migrating your application and
associated data to the target platform with minimal or no changes.
• Making VMs part of Kubernetes infrastructure along with containers, will help Lift &
Shift strategy for migrating applications running in VMs to Kubernetes.
*Pic credit: Google Cloud Copyright©2019 NTT Corp. All Rights Reserved. 8
KubeVirt Overview
• VMs run inside regular Kubernetes pods, where they have access to
standard pod networking and storage, and managed using standard
Kubernetes tools such as kubectl
• KubeVirt features
• Can be installed and removed in existing k8s cluster.
• Supports multiple network and storage options, suitable for migration
• VMs run as part of pod, so utilize all other k8s components like DNS, RBAC, Network
Policies etc.
• VM capabilities
• Run VM with images in qemu qcow2 format, same as in OpenStack
• latest device support
• Q35 machine support.
• Service creation
Reliability
• Maintenance downtime/disruption
VirtualMachine (VM) :
represents a virtual machine in the runtime environment of Kubernetes.
VirtualMachineInstanceReplicaSet (VMRS) :
Tries to ensures that a specified number of virtual machine replicas are running at any time.
DataVolume :
Data Volumes(DV) are an abstraction on top of Persistent Volume Claims(PVC) and the
Containerized Data Importer(CDI)
ContainerRegistryDisk :
local ephemeral disk for booting VMI. Any changes to disk are not persisted across reboot.
Expose Service
App in VM
Deploy
Prepare k8s Manifest
• Prepare VM • Export the VM • Prepare yaml • Deploy • Create
for Migration Disk & file for VM application Service
• Build Docker
image
Migration effort
• Image Migration
• Maintenance
DNS
http://my-company-intranet.com
Users
Monolithic App
NIC
in VM
Company Network
DNS
http://my-company-intranet.com
Users
Monolithic App
NIC
in VM
Persistent
data
• Application stores the data in file
based DB locally of disk
VM Platform (oVirt / ESXi ..)
Company Network
DNS
template:
spec:
terminationGracePeriodSeconds: 30
domain:
devices:
• Key definitions disks:
- disk:
• run strategy : defines vm state after object bus: virtio
name: pvcdisk
creation (running, manual etc) volumes:
• Volume - name: pvcdisk
persistentVolumeClaim:
• Network claimName: monolithic-vm-disk
networks:
- name: default
pod: {}
[1] : OpenShift supports KubeVirt templates, which is helpful Copyright©2019 NTT Corp. All Rights Reserved. 25
Migration process: Service Definition
Common to Kubernetes
• All solutions of Service Discovery of Kubernetes shall work with KubeVirt
VMs too.
apiVersion: v1
kind: Service
metadata:
name: intranet-services
spec:
ports:
- name: nodeport
nodePort: 30000
port: 27017
targetPort: 80
selector:
kubevirt.io/vm: monolithic-app
type: NodePort
Monolithic App
libvirtd
Service
Virt-launcher
Ingress
Or pod
NodePort Virt
handler
http://my-company-intranet.com
Users
Kubelet
Company Network
Kubernetes/KubeVirt do not add much value for maintenance phase for this
kind of application
• Backup/snapshot management.
• PersistentVolume (PV) is provided by K8s storage providers.
• Managed in similar way as PersistentVolume of K8s.
• On failure
• Depending on Run strategy, action can be defined.
DNS
http://webservices-intranet.com
Application
Frontend
Backend
Users
Logic
NIC
Company Network
DNS
Scalable
http://webservices-intranet.com
Application
Frontend
Backend
Users
Logic
NIC
No data Persistent
• Frontend & Application logic do not
stored data
store data locally.
• Backend store all data of application VM Platform (oVirt / ESXi ..)
• External network connect only frontend
Company Network
DNS
http://my-company-intranet.com
Application Type 3 tier web architecture.
Application
Frontend
Backend
Users • Application and Frontend should be scalable.
Logic
DB
• Persistent Storage
eth0 for Backend
Requirements • Networking Backend
• Inter-VM & external communication
• Volume Backup
VM Platform (oVirt / ESXi ..)
• Auto re-create of Application & Frontend VM
Policies • No auto re-creation of VM for Backend
• Health Check
Company Network
spec:
replica: 1
• To make Frontend and Application scalable, devices:
disks:
defined as VMReplicaSet(VMRS). - disk:
bus: virtio
name: containerdisk
- disk:
bus: virtio
• Though VMs created using ContainerDisk are name: configdisk
apiVersion: v1 apiVersion: v1
kind: Service Frontend kind: Service Application &
metadata: metadata:
name: web-server name: application-server Backend
spec: spec:
ports: ports:
- name: nodeport - name: clusterip
nodePort: 30002 port: 27021
port: 27019 targetPort: 80
targetPort: 80 selector:
selector: kubevirt.io/vm: application-app
kubevirt.io/vm: frontend-app type: ClusterIP
type: NodePort
Users
Kubelet
Company Network
Migration effort
- Migration process : Medium
- Online migration : No
- Maintenance : Good
Configuration
- Reliability with Kubernetes : Good &
Reliability
Deployment
Lesson learnt
- Name resolution/ Fixed IP reference in application
config, do not work. Hard
Maintenance Medium
- Hostname of VMs will be services of VM instance.
Easy
- Be expert in Kubernetes.
DNS
http://ha-services.com
Standby
Users
NIC VIP
Master
Company Network
Master Standby
Master Standby
VIP
postgresql postgresql
DATA - LAN
Pacemaker Pacemaker
InterConnect - LAN
corosync corosync
Master Standby
Copyright©2019 NTT Corp. All Rights Reserved. 49
Active-Standby without Shared Disk
VIP
Pacemaker Pacemaker
InterConnect - LAN
corosync corosync
Master Standby
*https://osdn.net/projects/pg-rex/ Copyright©2019 NTT Corp. All Rights Reserved. 50
Migration process: VM Definition of HA models
• Apart from Persistent Volume, this use case requires multiple Network segments.
• With private hosted Kubernetes, its hard to get Fixed IP over cluster.
• Service cannot have custom ClusterIP in different segment.
• Migration in KubeVirt is possible with hackish solution.
Service
NodePort
master standby
libvirtd libvirtd
virt-launcher virt-launcher
Virt
handler
http://ha-services.com
Kubelet
Users
Fixed IP
• Backup/snapshot management.
• PersistentVolume (PV) is provided by K8s storage providers.
• Managed in similar way as PersistentVolume of K8s.
• On failure
• Application logic of smooth failover works.
Simply Lift & Shift do not work for application with complex topology
- Online migration : No
- Maintenance : Medium
- Reliability with Kubernetes : Good Configuration
&
Reliability
Deployment
Lesson learnt
- Configuration changes are not apparent.
- Look beyond standard Kubernetes pod communication
Hard
channels Maintenance Medium
- Be expert in Kubernetes. Easy
• Challenges
• Reliable fencing mechanism
• Support for service IP other than default network segment
• Future work
• VM Definition generator from old VM configuration e.g. OVA file.
- Virtlet
- Project with similar goal, but implemented as Container
Runtime Interface(CRI) instead of CRD.
- KubeVirt is more active project compared to Virtlet.
• It will not be simple Lift & Shift, but shall be less expensive than rewriting or
restructuring in containers.
Kubernetes Master
Architecture: x86_64
Model name: Intel(R) Xeon(R) W-2123 CPU @ 3.60GHz
Hypervisor : KVM
Virtualization: full
Kernel: 4.18
OS: Fedora Server 29
Memory : 4GB Software version
Kubernetes version : v1.12.2
Kubernetes Worker Node x 2 KubeVirt Version : v0.17.0
CDI version : v1.9.0
Architecture: x86_64
Model name: Intel(R) Xeon(R) W-2123 CPU @ 3.60GHz
Hypervisor : KVM
Virtualization: full
Kernel: 4.18
OS: Fedora Server 29
Memory : 12GB
DNS
http://ha-services.com
Master-1
Users
NIC VIP
Master-2
Company Network
VIP
VIP Segment
heartbeat heartbeat
HA proxy HA proxy
HA Segment
mysqld mysqld
Data Segment
Master - 1 Master - 2
Copyright©2019 NTT Corp. All Rights Reserved. 66
Migration Process: VM Definition for MySQL Active-Active
• Defining multiple network VMs is same as pods using meta CNI plugins like
multus.
• Using cloudInit, its easy to make and try changes in application configuration
networks:
- name: default
pod:{}
- multus:
networkName: green-network
name: green-net
Service
NodePort
libvirtd libvirtd
virt-launcher virt-launcher
Virt
handler
http://ha-services.com
Kubelet
Users
Communication via IP