How to Troubleshoot Apps for the Modern Connected Worker
TECNIRIS@: OpenNebula Tutorial
1. OpenNebula Tutorial - RedIRIS 2013
November 19th, 2013
An Introduction to Cloud Computing with
OpenNebula
Daniel Molina Aranda
dmolina@opennebula.org
Project Engineer
Acknowledgments
The research leading to these results has received funding from the European Union's Seventh Framework
Programme ([FP7/2007-2013] ) under grant agreement n° 612053 (CloudCatalyst Project)
Creative Commons Attribution-NonCommercial-ShareAlike License
1/16
2. Agenda
An Introduction to Cloud Computing with OpenNebula
● Infrastructure as a Service
● The OpenNebula Model
● The Anatomy of the Cloud
An Introduction to Cloud Computing with OpenNebula
2
3. Infrastructure as a Service
Types of Cloud Services
What
Who
Software as a Service
On-demand access
to any application
End-user
(does not care about hw or sw)
Platform as a Service
Platform for building
and delivering web
applications
Developer
(no managing of the underlying hw &
swlayers)
Raw computer
infrastructure
System Administrator
(complete management of the
computer infrastructure)
Infrastructure as a
ᄎ
Service
Physical Infrastructure
An Introduction to Cloud Computing with OpenNebula
3
4. Infrastructure as a Service
Types of Cloud Deployments
Public Cloud
• Simple Web Interface
• Raw Infrastructure Resources
• Pay-as-you-go (On-demand access)
• Elastic & “infinite” Capacity
An Introduction to Cloud Computing with OpenNebula
4
5. Infrastructure as a Service
Types of Cloud Deployments
Public Cloud
• Simple Web Interface
• Raw Infrastructure Resources
• Pay-as-you-go (On-demand access)
• Elastic & “infinite” Capacity
Private Cloud
A “Public Cloud behind the firewall”
• Simplify internal operations
• Dynamic allocation of resources
• Higher utilization & operational savings
• Security concerns
An Introduction to Cloud Computing with OpenNebula
5
6. Infrastructure as a Service
Types of Cloud Deployments
Public Cloud
• Simple Web Interface
• Raw Infrastructure Resources
Private Cloud
A “Public Cloud behind the firewall”
• Pay-as-you-go (On-demand access)
• Elastic & “infinite” Capacity
• Simplify internal operations
• Dynamic allocation of resources
• Higher utilization & operational savings
• Security concerns
Hybrid Cloud
• Supplement the capacity of the Private Cloud
• Utility Computing dream made a reality!
An Introduction to Cloud Computing with OpenNebula
6
7. Infrastructure as a Service
Types of Cloud Deployments
Public Cloud
• Simple Web Interface
• Raw Infrastructure Resources
Private Cloud
A “Public Cloud behind the firewall”
• Pay-as-you-go (On-demand access)
• Elastic & “infinite” Capacity
• Simplify internal operations
• Dynamic allocation of resources
• Higher utilization & operational savings
• Security concerns
Hybrid Cloud
• Suplement the capacity of the Private Cloud
• Utility Computing dream made a reality!
An Introduction to Cloud Computing with OpenNebula
7
8. Infrastructure as a Service
Challenges of IaaS Clouds
● How do I provision a new VM?
Image Management & Context
● Where do I store the disks?
Storage
● How do I set up networking for a multitier service?
Network & VLANs
● Where do I put my web server VM?
Monitoring & Scheduling
● How do I manage any hypervisor?
Virtualization
● Who has access to the Cloud’s resources?
User & Role Management
● How do I manage my distributed infrastructure?
Interfaces & APIs
An Introduction to Cloud Computing with OpenNebula
8
9. Infrastructure as a Service
Challenges of IaaS Clouds
● How do I provision a new VM?
Image Management & Context
Uniform management
● Where do I store the disks?
Storage
layer that
orchestrates multiple technologies
● How do I set up networking for a multitier service?
Network & VLANs
● Where do I put my web server VM?
Monitoring & Scheduling
● How do I manage any hypervisor?
Virtualization
● Who has access to the Cloud’s resources?
User & Role Management
● How do I manage my distributed infrastructure?
Interfaces & APIs
An Introduction to Cloud Computing with OpenNebula
9
10. The Anatomy of the Cloud
Cloud Architecture - The Internals of the Cloud
Interfaces, Tools & API
• CLI & Sunstone (GUI)
• API
• Cloud (EC2,OCCI)
• Service Management & Catalogs
Network
Storage
• VLAN
• VM disks (file & block)
• Firewalling
• Image Distribution
• Multiple Technologies
• Multiple Backends
Compute Hosts
Multi-tenancy
• Grouped into logical clusters
• AAA Services
• Multiple hypervisors
• Scheduling
• Monitoring
• Permissions & roles
An Introduction to Cloud Computing with OpenNebula
10
11. The Anatomy of the Cloud
Different Perspectives of the Cloud – Demands from the Different Communities
Cloud Consumer
Cloud
Administrator
Cloud Application
Developer
Cloud Integrator
An Introduction to Cloud Computing with OpenNebula
11
12. Infrastructure as a Service
An Uniform Management Layer
An Introduction to Cloud Computing with OpenNebula
12
13. Story
A Project Aimed at Building the Industry Standard Open Cloud Management Tool
Large-scale production
deployment: 16,000 VMs
•Develop & innovate
•Support the community
•Collaborate
TP
v1.0
v1.2 v1.4
v2.0
v2.2 v3.0 v3.2 v3.4 v3.6 v3.8 v4.0 V4.2
2005
2008
2009
2010
2011
2012
2013
2014
5,000
downloads/month
Research
Project
An Introduction to Cloud Computing with OpenNebula
13
14. The OpenNebula Model
Design principles
Openness
Adaptable
• Open Architecture
• Open Interfaces & Code
• Modular architecture
Proven
• Tested & Mature
Powerful
• Features for
DC virtualization
Very Light
• Highly efficient
No Lock-In
• Platform
independant
Interoperable
Enterprise Ready
• Use of standards
• OCCI, AWS EC2
• Single installing & update process
• Support for various platforms
An Introduction to Cloud Computing with OpenNebula
14
15. The OpenNebula Model
Widely Used to Build Enterprise Private Clouds in Medium and Large Data Centers
Reference Users
Survey Q2/Q3 2012 (2,500 users http://c12g.com/resources/survey/)
An Introduction to Cloud Computing with OpenNebula
15
16. The Anatomy of the Cloud
OpenNebula Architecture - Infrastructure Agnostic and Highly Customizable
CLI
Cloud
Servers
GUI
Scheduler
OCA (Ruby, Java)
XML-RPC API
OpenNebula core
Monitoring
Storage
Network
Virtualization
Images
Auth
DB
Languages
An Introduction to Cloud Computing with OpenNebula
16
17. The Anatomy of the Cloud
Basic OpenNebula Deployment
Monitoring,Virtualization,
Storage and Network
• Repository of VM images
• Multiple Backends (LVM, Ceph)
• Provides physical resources for the VMs
• Must have a hypervisor installed
An Introduction to Cloud Computing with OpenNebula
17
18. Questions?
We Will Be Happy to Clarify Any Question
An Introduction to Cloud Computing with OpenNebula
18
19. OpenNebula Tutorial - RedIRIS 2013
November 19th, 2013
Installation and Basic Usage
Daniel Molina Aranda
dmolina@opennebula.org
Project Engineer
Acknowledgments
The research leading to these results has received funding from the European Union's Seventh Framework
Programme ([FP7/2007-2013] ) under grant agreement n° 612053 (CloudCatalyst Project)
Creative Commons Attribution-NonCommercial-ShareAlike License
19/16
20. Agenda
Installing and Basic Usage
● Planning the Installation
● Virtual Lab Configuration
● Basic Usage
● Managing Hosts
● Images, Networks, Templates and VMs
● Managing Users, Quotas and ACLs
● Logging & Debugging
● Configuration Files
● Appendix A - Installation
An Introduction to Cloud Computing with OpenNebula
20
21. A Typical OpenNebula Environment
Planning the Installation
Monitoring,Virtualization,
Storage and Network
• Repository of VM images
• Multiple Backends (LVM, Ceph)
• Provides physical resources for the VMs
• Must have a hypervisor installed
An Introduction to Cloud Computing with OpenNebula
21
22. Required Software
Installing
● Head node
● ssh, ruby
● OpenNebula: oned, mm_sched, sunstone, …
● Worker nodes
● Hypervisor (KVM, Xen or VMWare)
● ssh, ruby (Xen & KVM)
● Optional
● Storage Backends (LVM, iSCSI, Ceph, …)
● Networking systems (VLAN, Open vSwitch, …)
● Ganglia, LDAP, Apache, Nginx
An Introduction to Cloud Computing with OpenNebula
22
23. Virtual Lab
Planning the Installation
NODE 1
An Introduction to Cloud Computing with OpenNebula
NODE 2
23
24. Virtual Lab
Installing
● Start Virtual Box
● File > Import Appliance…
● frontend_node1.ova & node2.ova
● Create a Host-only network in VirtualBox if you have
not created it yet
An Introduction to Cloud Computing with OpenNebula
24
25. Virtual Lab
Installing
● Start frontend_node1 and node2 images
● You can access them from:
1. VirtualBox GUI
2. Console/putty
● frontend_node1 (password centos)
$ ssh localhost -l root -p 2222
● node2 (password centos)
$ ssh localhost -l root -p 2223
An Introduction to Cloud Computing with OpenNebula
25
26. CLI – node1
Basic Usage
Hands on (node1) !
● OpenNebula CLI Commands
# su - oneadmin
$ one[TAB]
oneuser
Manage Users
oneimage
Manage Images
onegroup
Manage Groups
onetemplate
Manage Templates
oneacl
Manage ACLs
onevm
Manage VMs
onehost
Manage Hosts
oneacct
Accounting Tool
onecluster
Manage Clusters
onemarket
Marketplace Tool
onevnet
Manage Networks
onedb
DB Tool
onedatastore
Manage Datastores
An Introduction to Cloud Computing with OpenNebula
26
27. CLI – node1
Basic Usage
● Get the Sunstone Login information
# (as oneadmin)
$ cat ~/.one/one_auth
oneadmin:<password>
● Try out sunstone!
http://localhost:9869
An Introduction to Cloud Computing with OpenNebula
27
28. Adding Hosts - Sunstone
Basic Usage – Hosts
Hands on! (Sunstone)
● Create one host in Sunstone: node1
● Virtualization: KVM
● Information: KVM
● Network:
dummy
● Cluster:
none
● Watch transition INIT ON
● Click on the row for more information
● Automatic gathering of monitoring data
● Take a look at the graphs
An Introduction to Cloud Computing with OpenNebula
28
29. Adding Hosts - CLI
Basic Usage – Hosts
Hands on! (CLI)
(always as oneadmin in the Frontend – node 1)
$ onehost -help
$ onehost create -help
$
$
$
$
ssh node2 ls /var/tmp/one
onehost create node2 -i kvm -v kvm -n dummy
onehost list
onehost top
# Wait for ON ... and then CTRL-C
$
$
$
$
ssh node2 ls
onehost show
onehost show
onehost show
/var/tmp/one
node2
1
-x 1
An Introduction to Cloud Computing with OpenNebula
29
30. Adding Images
Basic Usage – Images
Hands on! (Sunstone)
● Create an Image in Sunstone
● Name: tty
● Provide a Path: /var/tmp/tutorial/ttylinux.qcow2.img
● Advanced Driver: qcow2
● Datastore: default
● Create!
● Watch transition LOCKED READY
● Ownership and Permissions (ala Unix!), Size, Driver...
Hands on! (CLI)
$ oneimage list
$ oneimage show tty
# DO NOT EXECUTE THE FOLLOWING COMMAND
$ oneimage create --name tty --driver qcow2
--path /var/tmp/tutorial/ttylinux.qcow2.img -d default
An Introduction to Cloud Computing with OpenNebula
30
31. System Datastore
Basic Usage – Datastores
Hands on! (Sunstone)
● Inspect each Datastore:
● The system datastore:
● Holds images for running VMs
● The TM_MAD (transfer manager driver) is shared which means:
An Introduction to Cloud Computing with OpenNebula
31
32. Shared Datastore
Basic Usage – Datastores
Hands on! (Sunstone)
● The default datastore:
● Holds images ready to be cloned or linked for VMs
● The DS_MAD is fs because our image is a regular file
● The TM_MAD (transfer manager driver) is shared which means:
An Introduction to Cloud Computing with OpenNebula
32
33. Adding Networks
Basic Usage – Networks
Hands on! (Sunstone)
● Create a new Network
● Name: private
● Type: Fixed Network
● IP: 192.168.0.1 -> [ENTER] -> repeat ... -> 192.168.0.4
● Network Model: default
● Bridge: br1
VM
VM
VM
VM
br1
br1
eth1
eth1
Node 1
Node 2
An Introduction to Cloud Computing with OpenNebula
33
34. Adding Networks
Basic Usage – Networks
Hands on! (Sunstone)
● Network extended information:
● Lease Management Add, Hold and Remove Leases
Hands on! (CLI)
$ cat private2.net
NAME = private2
TYPE = fixed
BRIDGE = br1
LEASES = [ IP = 10.0.0.1 ]
LEASES = [ IP = 10.0.0.2 ]
$
$
$
$
$
onevnet
onevnet
onevnet
onevnet
onevnet
create private2
list
show private
addleases private 192.168.0.105
hold private 192.168.0.105
An Introduction to Cloud Computing with OpenNebula
34
35. Adding Templates
Basic Usage – Template
Hands on! (Sunstone)
● A template is a Virtual Machine definition ready to be instantiated
● It has CPU, Memory, Disks, NIC, Graphical Ports, etc...
● Create a new Template:
● Name:
ttylinux
● CPU:
0.1
● Memory:
64M
● Storage:
tty
● Network:
private
● Input/Output: VNC
● Random values in Context Custom Variables
● Create!
An Introduction to Cloud Computing with OpenNebula
35
36. Adding Templates
Basic Usage – Template
Hands on! (CLI)
● Try the useful --dry option in the CLI
$ onetemplate create --help
$ onetemplate create --name ttylinux --cpu 0.1
--memory 64 --disk tty --nic private --vnc --dry
NAME="ttylinux“
CPU=0.1
MEMORY=64
DISK=[
IMAGE="tty“
]
NIC=[
NETWORK="private“
]
GRAPHICS=[ TYPE="vnc", LISTEN="0.0.0.0" ]
An Introduction to Cloud Computing with OpenNebula
36
37. Instantiating
Basic Usage – VMs
Hands on! (Sunstone)
● Instantiate the template
● Deploy 2 VMs
● Leave the name blank
● Watch the transition PENDING RUNNING
● In which host is running each VM?
● vnc (vm1) root / password
● ifconfig configured using context
● ping the other machine (vm2)
● Migrate / live-migrate (vm2)
An Introduction to Cloud Computing with OpenNebula
37
38. Main VM actions
Basic Usage – VMs
suspend
VM state saved. Kept in the host.
power off (--hard)
Powers off a VM. Kept in the host.
stop
VM state saved. Taken to the system datastore.
undeploy (--hard)
Powers off a VM. Taken to the system datastore.
reboot (--hard)
Reboots the VM.
delete --recreate
Cleans the VM and moves it to PENDING.
shutdown (--hard)
Powers off a VM, cleans host and VM is removed
from OpenNebula.
delete
VM is immediately destroyed regardless of state.
Recommended only for oneadmin.
An Introduction to Cloud Computing with OpenNebula
38
39. Other VM actions
Basic Usage – VMs
Hands on! (Sunstone)
● VM extended information tab
● Capacity - Resize VM capacity (power off –hard, first halt from vnc)
● Storage
● Network - Attach new nic
● create a new network attach nic reboot from vnc
● Snapshot
● create a file using VNC
● Take snapshot
● Modify the file
● Revert
● Placement
● Actions - Schedule action
● Template
● Log
An Introduction to Cloud Computing with OpenNebula
39
40. Managing Users
Basic Usage – Users
Hands on! (Sunstone)
● Create new user: testuser / testpass
● Click on new user Update Quotas
● Enforce 1 Max VMs Add/edit quota
● Other possible options
● limit the use of a Datastore
● limit the use of an Image
● limit the use of a Network
● Apply changes!
An Introduction to Cloud Computing with OpenNebula
40
41. Logs
Basic Usage – Logging and Debugging
● Logs are kept under /var/log/one
● oned.log: all the information related to the oned daemon. Every
request, actions and driver errors will be here.
The verbosity is set by DEBUG_LEVEL in /etc/one/oned.conf
● sched.log:has all the information related to the placement of Virtual
Machines. If a VM is not being deployed (kept in PENDING state), this
log will explain why.
● <id>.log: the log of each VM. Also accessible through Sunstone.
An Introduction to Cloud Computing with OpenNebula
41
42. oned.conf
Configuration
/etc/one/oned.conf (open this file and take a look!)
● OpenNebula Daemon:
● LOG, PORT, DB
● Monitoring Intervals:
● MANAGER_TIMER, MONITORING_INTERVAL
● Configuration options for VMs:
● VNC_BASE_PORT
● MAC_PREFIX (MAC IP)
● DEFAULT_DEVICE_PREFIX = "hd“ (or vd, xvd, etc…)
● Drivers:
● IM_MAD, VMM_MAD, TM_MAD, DATASTORE_MAD, HM_MAD, AUTH
_MAD
● Resources:
● DEFAULT_UMASK
● VM_RESTRICTED_ATTR, IMAGE_RESTRICTED_ATTR
An Introduction to Cloud Computing with OpenNebula
42
43. sched.conf
Configuration
/etc/one/sched.conf (open this file and take a look!)
● Scheduler Daemon:
● ONED_PORT, SCHED_INTERVAL, LOG
● Dispatch Options
● MAX_VM, MAX_DISPATCH, MAX_HOST, LIVE_RESCHEDS
● Policy
● DEFAULT_SCHED (packing, striping, load-aware, custom)
An Introduction to Cloud Computing with OpenNebula
43
44. Questions?
We Will Be Happy to Clarify Any Question
An Introduction to Cloud Computing with OpenNebula
44
45. Appendix A
Installation
This is just a reference of what have been done to configure the frontend_node1 and
node2 images
An Introduction to Cloud Computing with OpenNebula
45
46. Installation node 1 - Frontend
Installing
● Activate repo and Install Packages
# cp /var/tmp/tutorial/opennebula.repo /etc/yum.repos.d/
# yum clean all
# yum install opennebula-server opennebula-sunstone
opennebula-node-kvm
● Add QEMU drivers
# Change VM_MAD type from kvm to qemu
● Configure NFS Server
# cat /etc/exports
/var/lib/one
*(rw,sync,no_subtree_check,root_squash,anonuid=9869,anongid=9869)
An Introduction to Cloud Computing with OpenNebula
46
47. Installation node 1 - Frontend
Installing
● Configure Sunstone
# sed -i 's/127.0.0.1/0.0.0.0/' /etc/one/sunstone-server.conf
● Start Services
#
#
#
#
#
service nfs start
service libvirtd start
service opennebula start
service opennebula-sunstone start
chkconfig nfs on
● Quick overview of the CLI
#
#
$
$
gpasswd -a oneadmin wheel
su - oneadmin
oneuser show
oneuser -help
An Introduction to Cloud Computing with OpenNebula
47
48. Installation node 2 – Worker Node
Installing
● Activate repo and Install Packages
# cp /var/tmp/tutorial/opennebula.repo /etc/yum.repos.d/
# yum clean all
# yum install opennebula-node-kvm
● Configure Network, Hostname, NFS and sudo
# chkconfig NetworkManager off
# service NetworkManager stop
# echo HOSTNAME=node2 > /etc/sysconfig/network
# hostname node2
# sed -i 's/1.1.1.1/1.1.1.2/' /etc/sysconfig/networkscripts/ifcfg-br1
# ifconfig br1 1.1.1.2/24 up
# mount –t nfs 1.1.1.1:/var/lib/one /var/lib/one
# gpasswd -a oneadmin wheel
# service libvirtd start
An Introduction to Cloud Computing with OpenNebula
48
49. Configure Password-less SSH
Installing
● OpenNebula needs passwordless ssh access to
all the nodes from all the nodes:
# (as oneadmin)
$ ssh-keyscan node1 node2 > ~/.ssh/known_hosts
# test it!
$
$
$
$
ssh node2
exit
ssh node1
exit
An Introduction to Cloud Computing with OpenNebula
49