opennebulaconf 2016 - hypervisors and containers hands-on workshop by jaime melis, opennebula

43
Jaime Melis OpenNebula Engineer // @j_melis // [email protected] Hypervisors & Containers OpenNebulaConf 2016 4 th edition

Upload: opennebula-project

Post on 16-Apr-2017

297 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Jaime MelisOpenNebula Engineer // @j_melis //

[email protected]

Hypervisors & Containers

OpenNebulaConf 20164th edition

Page 2: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Agenda

Page 3: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Introduction

KVM

Virtual Infra Management•Capacity management •Multi-VM management•Resource optimization •HA and business continuity

OpenNebula

Cloud Management•VDC multi-tenancy•Simple cloud GUI and interfaces•Service elasticity/provisioning•Federation/hybrid

vCenter

VMware

OpenNebula

Page 4: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Reference Architecture

Page 5: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Reference Architecture

Basic Advanced

Operating System

Supported OS (Ubuntu or CentOS/RHEL) in all machines Specific OpenNebula packages installed

Hypervisor KVM

Networking VLAN 802.1Q VXLAN

Storage Shared file system (NFS/GlusterFS) using qcow2

format for Image and System Datastores

Ceph Cluster for Image Datastores, and a separated

Shared FS for System Datastore

Authentication Native authentication or Active Directory

Basic and Advanced Implementations

Page 6: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Reference Architecture

Basic Advanced

Memory 2 GB 4 GB

CPU 1 CPU (2 cores) 2 CPU (4 cores)

Disk size 100 GB 500 GB

Network 2 NICs 2 NICs

Front-end Hardware recommendations

Page 7: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Reference Architecture

Network Implementations

Private Network

Communication between VMs.

Public Network To serve VMs that need internet access

Service Network

For front-end and virtualization node communication -including inter node communication for live migration-, as well as for storage traffic

Storage Network

To serve the the shared filesystem or the Ceph pools to the virtualization nodes

Page 8: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Configuring Drivers

VM_MAD = [

NAME = "kvm",

SUNSTONE_NAME = "KVM",

EXECUTABLE = "one_vmm_exec",

ARGUMENTS = "-t 15 -r 0 kvm",

DEFAULT = "vmm_exec/vmm_exec_kvm.conf",

TYPE = "kvm",

KEEP_SNAPSHOTS = "no",

IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold,

release, suspend, resume, delete, reboot, reboot-hard, resched,

unresched, disk-attach, disk-detach, nic-attach, nic-detach,

snap-create, snap-delete" ]

Page 9: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Monitoring Hosts

Page 10: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Monitoring Hosts

Wed Oct 19 14:43:20 2016 [Z0][InM][D]: Monitoring host host01 (0)

Wed Oct 19 14:43:21 2016 [Z0][InM][D]: Host host01 (0)

successfully monitored.

Wed Oct 19 14:43:31 2016 [Z0][InM][D]: Host host01 (0)

successfully monitored.

Wed Oct 19 14:43:51 2016 [Z0][InM][D]: Host host01 (0)

successfully monitored.

...

Page 11: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Capacity

Attributes

● MEMORY

● CPU

● VCPU

Overcommitment

● RESERVED_CPU

● RESERVED_MEMORY

Page 12: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Cgroups

What is?

● Enforce CPU assigned to a VM● VM with CPU=0.5 gets half of another VM CPU=1.0● You can limit the total memory used by the VMs

How?

● Check your distro● Configuration in the hosts (not in the front-end)● There is a cgroups service● Enable in /etc/libvirt/qemu.conf● Add libvirt to /etc/cgrules.conf

Page 13: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Fast VM Deployments

● Libvirt listens by default on a unix socket● No concurrent operations

/etc/one/sched.conf

# MAX_HOST: Maximum number of Virtual

Machines dispatched to a given host in

# each scheduling action

#

MAX_HOST = 1

● Enable TCP socket in libvirtd.conf

Page 14: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

RAW

If it's supported by Libvirt… it's supported by OpenNebula

RAW = [ type = "kvm",

data = "<devices>

<serial type=\"pty\"><source path=\"/dev/pts/5\"/><target

port=\"0\"/></serial>

<console type=\"pty\" tty=\"/dev/pts/5\"><source

path=\"/dev/pts/5\"/><target port=\"0\"/></console>

</devices>"

]

Libvirt Deployment File (XML)

Page 15: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Improve Performance

● Paravirtualized drivers● Network● Storage

Enable it by default:

/etc/one/vmm_exec/vmm_exec_kvm.conf

NIC = [ MODEL = "virtio" ]

/etc/one/oned.conf

DEFAULT_DEVICE_PREFIX = "vd"

virtio

Page 16: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Further Tips

KSM

● Kernel Samepage Merging● Combines Memory private pages● Increases VM density● Enabled by default in CentOS

SPICE

● Native in OpenNebula >= 4.12 (qlx display Driver)● Redirect printers, USB (mass-storage), Audio

Page 17: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Further Tips

Virsh Capabilities

/usr/share/libvirt/cpu_map.xml

OS = [ MACHINE = "..." ]

Cache

● Writethrough○ host page on, guest disk write cache off

● Writeback○ Good overall I/O Performance○ host page on, disk write cache on

● None○ Good write performance○ host page off, disk write cache on

Page 18: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

vCenter Approach

KVM

Virtual Infra Management•Capacity management •Multi-VM management•Resource optimization •HA and business continuity

OpenNebula

Cloud Management•VDC multi-tenancy•Simple cloud GUI and interfaces•Service elasticity/provisioning•Federation/hybrid

vCenter

VMware

OpenNebula

Page 19: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Reference Architecture

Page 20: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Reference Architecture

Description

Front-end Supported OS (Ubuntu or CentOS/RHEL)Specific OpenNebula packages installed

Hypervisor VMware vSphere (managed through vCenter)

Networking Standard and Distributed Switches (managed through vCenter)

Storage Local and Networked (FC, iSCSI, SAS) (managed through vCenter)

Authentication Native authentication or Active Directory

Summary of the implementation

Page 21: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

VM_MAD = [

NAME = "vcenter",

SUNSTONE_NAME = "VMWare vCenter",

EXECUTABLE = "one_vmm_sh",

ARGUMENTS = "-p -t 15 -r 0 vcenter -s sh",

DEFAULT = "vmm_exec/vmm_exec_vcenter.conf",

TYPE = "xml",

KEEP_SNAPSHOTS = "yes",

IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold,

release, suspend, resume, delete, reboot, reboot-hard, resched,

unresched, poweroff, poweroff-hard, disk-attach, disk-detach,

nic-attach, nic-detach, snap-create, snap-delete"

]

Configuring Drivers (Virtualization)

Page 22: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Configuring Drivers (Monitoring)

IM_MAD = [

NAME = "vcenter",

SUNSTONE_NAME = "VMWare vCenter",

EXECUTABLE = "one_im_sh",

ARGUMENTS = "-c -t 15 -r 0 vcenter" ]

Page 23: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

vCenter Delegation

VMs

Templates

Networks

Page 24: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Overview

Key Points

● VMware workflows● Leverages vMotion, HA, DRS● Templates and Networks must exist● Each vCenter cluster is a Host

○ OpenNebula chooses the Host (vCenter cluster)○ VMware DRS chooses the ESX Host

● VMware tools in guest OS

Limitations

● Security Groups● Files passed in the Context

Page 25: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

vCenter

ESX HostESX Host

Connectivity

VNC

OpenNebula Frontend

ESX HostsVI API

ESX HostESX HostESX Hosts

VMM Driver

Page 26: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Clusters

● Sunstone to import vCenter Clusters● CLI Tool also provides that functionality● Manages subsequent import actions

Page 27: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Templates

● A Template must be already defined in OpenNebula.● It must contain all the basic information to be deployed● During instantiation we can add an extra network, but not

remove them.

Page 28: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Templates

● The Template includes the vCenter UUID.● Keep VM Disks is optional

Page 29: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Templates

● User can be asked about Resource Pool and Datastore

Page 30: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Networks

● The Network must exist in OpenNebula.● When importing, we can assign an IP range for the

Network

Page 31: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing VMs

● Wild VMs can be imported● After importing, VMs can be managed by OpenNebula

● The following operations cannot be performed:○ delete --recreate○ undeploy○ migrate○ stop

Page 32: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Datastores and VMDKs

● Available through CLI and Sunstone● Same mechanism as with VMs, Networks and Templates

Page 33: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Importing Datastores and VMDKs

vCenter datastores supported in OpenNebula

● Monitorization of Datastores and VMDKs● VMDK Creation● VMDK Upload● VMDK Cloning● VMDK Deletion

Persistent VMDK

VMDK Hotplug supported

● Attach disk

Page 34: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Contextualization

● Two supported Contextualizations methods:○ vCenter Customizations○ OpenNebula

● OpenNebula Contextualization works both for Windows and Linux.

● START_SCRIPT is supported

Page 35: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Scheduling

● OpenNebula chooses a Host (vCenter Cluster)

● The specific ESX is selected by vCenter (DRS)

● The specific Cluster can be forced:

SCHED_REQUIREMENTS = "NAME=\"<vcenter_cluster>\""

Page 36: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Docker

Docker Machine

Page 37: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Docker-Machine

● Official Docker project● Deploys transparently your Docker host● Supports Multiple Backends● Switch between your Docker hosts

Page 38: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Boot2Docker

Lightweight Linux distribution based on Tiny Core Linux made specifically to run Docker containers.

http://boot2docker.io

Page 39: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Requirements

● OpenNebula Cloud

● Image for Docker Engine (Boot2Docker) & Network

● Docker Client Tools & Docker Machine

● Docker Machine OpenNebula Plugin

○ github.com/OpenNebula/docker-machine-opennebula

Page 40: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Docker Machine OpenNebula Plugin

docker-machine create \

--driver opennebula \

--opennebula-network-name private \

--opennebula-image-name boot2docker \

--opennebula-b2d-size 18192 \

my_docker_host

Page 41: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Docker Swarm

● Native clustering for Docker● Pool of Docker hosts into a single, virtual Docker host● Scale to multiple hosts

Page 42: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

Rancher

● Complete Platform for Running Containers● Entire software stack● Supports Docker Machine provisioning

Page 43: OpenNebulaConf 2016 - Hypervisors and Containers Hands-on Workshop by Jaime Melis, OpenNebula

OpenNebulaConf 20164th edition

Platinum

Gold

Silver

Community

THANKS!