SlideShare a Scribd company logo
OSDC Berlin | May 14 - 15 2019
Kosisochukwu Anyanwu
Software Engineer, Kinvolk
Github: kosyfrances
Twitter: kosyfrances
Email: kosy@kinvolk.io
The Deep-stack Kubernetes
Experts
Engineering services and products for
Kubernetes, containers, process
management and Linux user-space +
kernel
Blog: kinvolk.io/blog
Github: kinvolk
Twitter: kinvolkio
Email: hello@kinvolk.io
Containers and VMs
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu
Also known as Virtual Machine Monitor.
A process that creates and runs virtual machines.
Shares host machine’s resources.
Examples: VirtualBox, VMware, KVM.
Kernel-based Virtual Machine
Lets you turn Linux into a hypervisor
root@591532:/# egrep -c '(vmx|svm)' /proc/cpuinfo
vmx – Intel VT-x, virtualisation support enabled in BIOS
svm – AMD SVM,virtualisation enabled in BIOS.
If the count is 0, then your CPU does not support hardware virtualisation.
Source: Docker
VM inside a Container?
Examples:
You want a VM in a CI that runs everything in containers.
Your OS runs everything in containers and you want a
VM
How can this be done?
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu
FROM ubuntu:18.04
RUN apt-get update -y && 
DEBIAN_FRONTEND=noninteractive apt-get
install -y qemu-kvm libvirt-daemon-system
libvirt-clients bridge-utils vagrant && 
apt-get autoclean && 
apt-get autoremove && 
vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]
FROM ubuntu:18.04
RUN apt-get update -y && 
DEBIAN_FRONTEND=noninteractive apt-get
install -y qemu-kvm libvirt-daemon-system
libvirt-clients bridge-utils vagrant && 
apt-get autoclean && 
apt-get autoremove && 
vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]
FROM ubuntu:18.04
RUN apt-get update -y && 
DEBIAN_FRONTEND=noninteractive apt-get
install -y qemu-kvm libvirt-daemon-system
libvirt-clients bridge-utils vagrant && 
apt-get autoclean && 
apt-get autoremove && 
vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]
FROM ubuntu:18.04
RUN apt-get update -y && 
DEBIAN_FRONTEND=noninteractive apt-get
install -y qemu-kvm libvirt-daemon-system
libvirt-clients bridge-utils vagrant && 
apt-get autoclean && 
apt-get autoremove && 
vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]
FROM ubuntu:18.04
RUN apt-get update -y && 
DEBIAN_FRONTEND=noninteractive apt-get
install -y qemu-kvm libvirt-daemon-system
libvirt-clients bridge-utils vagrant && 
apt-get autoclean && 
apt-get autoremove && 
vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]
FROM ubuntu:18.04
RUN apt-get update -y && 
DEBIAN_FRONTEND=noninteractive apt-get
install -y qemu-kvm libvirt-daemon-system
libvirt-clients bridge-utils vagrant && 
apt-get autoclean && 
apt-get autoremove && 
vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]
# startup.sh script
set -eou pipefail
chown root:kvm /dev/kvm
service libvirtd start
service virtlogd start
exec "$@"
# startup.sh script
set -eou pipefail
chown root:kvm /dev/kvm
service libvirtd start
service virtlogd start
exec "$@"
Remember to
chmod +x startup.sh
Build the container
docker build -t vmindocker:latest -f Dockerfile .
Let us run the container.
docker run --privileged -it
vmindocker bash
"privileged" is pretty much an alias to
"all the security features disabled"
docker run -it
--device=/dev/kvm
--device=/dev/net/tun
-v /sys/fs/cgroup:/sys/fs/cgroup:rw
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN vmindocker bash
docker run -it
--device=/dev/kvm
--device=/dev/net/tun
-v /sys/fs/cgroup:/sys/fs/cgroup:rw
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN vmindocker bash
docker run -it
--device=/dev/kvm
--device=/dev/net/tun
-v /sys/fs/cgroup:/sys/fs/cgroup:rw
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN vmindocker bash
docker run -it
--device=/dev/kvm
--device=/dev/net/tun
-v /sys/fs/cgroup:/sys/fs/cgroup:rw
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN vmindocker bash
docker run -it
--device=/dev/kvm
--device=/dev/net/tun
-v /sys/fs/cgroup:/sys/fs/cgroup:rw
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN vmindocker bash
docker run -it
--device=/dev/kvm
--device=/dev/net/tun
-v /sys/fs/cgroup:/sys/fs/cgroup:rw
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN vmindocker bash
You’d also need to:
mount -o remount,rw /sys
mount -o remount,rw /proc/sys
Spin up a VM in the container.
vagrant init generic/alpine37
vagrant up
vagrant ssh
# Check that it supports virtualisation
root@59157fd1ed32:/# egrep -c '(vmx|svm)' /proc/cpuinfo
# Spin up another VM inside of this VM :)
Short demo
https://youtu.be/1quxgKLnEy0
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu
Kosisochukwu Anyanwu
Github: kosyfrances
Twitter: kosyfrances
Email: kosy@kinvolk.io
Kinvolk
Blog: kinvolk.io/blog
Github: kinvolk
Twitter: kinvolkio
Email: hello@kinvolk.io

More Related Content

What's hot (20)

PDF
PHP-VCR behat case study
Pascal Thormeier
 
PPTX
CI-CD WITH GITLAB WORKFLOW
AddWeb Solution Pvt. Ltd.
 
PDF
Very Early Review - Rocket(CoreOS)
충섭 김
 
PDF
Ops for NoOps - Operational Challenges for Serverless Apps
Erica Windisch
 
PDF
Automatic docker service announcement with registrator and confd
충섭 김
 
PDF
Gitlab - Creating C++ applications with Gitlab CI
Uilian Ries
 
PDF
PHP-VCR Lightningtalk
Adrian Philipp
 
PDF
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Develcz
 
PPTX
Git, gitHub, Azure and Visual Studio
Salvatore Sorrentino
 
PDF
Composer - Panada Conference 2014
Mulia Nasution
 
PDF
Building Composable Serverless Apps with IOpipe
Erica Windisch
 
PPTX
Understanding kube proxy in ipvs mode
Victor Morales
 
PDF
Ci For The Web 2.0 Guy Or Gal
Chad Woolley
 
PPTX
Node.js kubernetes-cloud all the buzzwords coming together with microsoft azure
Patriek van Dorp
 
PDF
"fireap" - fast task runner on consul
IKEDA Kiyoshi
 
PDF
Going Serverless: The Best Ops is NoOps.
PolarSeven Pty Ltd
 
PDF
grifork - fast propagative task runner -
IKEDA Kiyoshi
 
KEY
Capistrano, Puppet, and Chef
David Benjamin
 
PDF
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
Yahoo!デベロッパーネットワーク
 
PPTX
Composer Panada Conference 2014 by Mulia Nasution
k4ndar
 
PHP-VCR behat case study
Pascal Thormeier
 
CI-CD WITH GITLAB WORKFLOW
AddWeb Solution Pvt. Ltd.
 
Very Early Review - Rocket(CoreOS)
충섭 김
 
Ops for NoOps - Operational Challenges for Serverless Apps
Erica Windisch
 
Automatic docker service announcement with registrator and confd
충섭 김
 
Gitlab - Creating C++ applications with Gitlab CI
Uilian Ries
 
PHP-VCR Lightningtalk
Adrian Philipp
 
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Develcz
 
Git, gitHub, Azure and Visual Studio
Salvatore Sorrentino
 
Composer - Panada Conference 2014
Mulia Nasution
 
Building Composable Serverless Apps with IOpipe
Erica Windisch
 
Understanding kube proxy in ipvs mode
Victor Morales
 
Ci For The Web 2.0 Guy Or Gal
Chad Woolley
 
Node.js kubernetes-cloud all the buzzwords coming together with microsoft azure
Patriek van Dorp
 
"fireap" - fast task runner on consul
IKEDA Kiyoshi
 
Going Serverless: The Best Ops is NoOps.
PolarSeven Pty Ltd
 
grifork - fast propagative task runner -
IKEDA Kiyoshi
 
Capistrano, Puppet, and Chef
David Benjamin
 
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
Yahoo!デベロッパーネットワーク
 
Composer Panada Conference 2014 by Mulia Nasution
k4ndar
 

Similar to OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu (20)

PDF
Comando kvm terminal
Carlos Eduardo
 
PDF
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
RapidValue
 
DOCX
Krenel Based Virtual Machine In Centos7
a_ratra
 
PDF
Kubernetes laravel and kubernetes
William Stewart
 
PDF
Create Development and Production Environments with Vagrant
Brian Hogan
 
PDF
Deploying Symfony | symfony.cat
Pablo Godel
 
PDF
Building your own Desktop Cloud Environment
Jnaapti
 
PDF
Virtual Infrastructure
Bryan McLellan
 
PDF
Preparation study of_docker - (MOSG)
Soshi Nemoto
 
PDF
Automate drupal deployments with linux containers, docker and vagrant
Ricardo Amaro
 
PDF
How to Install KVM (Kernel-based Virtual Machine) on Debian 12
Green Webpage
 
PDF
Containerizing your Security Operations Center
Jimmy Mesta
 
PDF
OpenStack Murano introduction
Victor Zhang
 
PDF
Continuous Integration: SaaS vs Jenkins in Cloud
Ideato
 
KEY
Vagrant
Michael Peacock
 
PDF
Monitoring kubernetes with prometheus
Brice Fernandes
 
PDF
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
PDF
KVM tools and enterprise usage
vincentvdk
 
PDF
Embacing service-level-objectives of your microservices in your Cl/CD
Nebulaworks
 
PPTX
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
Comando kvm terminal
Carlos Eduardo
 
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
RapidValue
 
Krenel Based Virtual Machine In Centos7
a_ratra
 
Kubernetes laravel and kubernetes
William Stewart
 
Create Development and Production Environments with Vagrant
Brian Hogan
 
Deploying Symfony | symfony.cat
Pablo Godel
 
Building your own Desktop Cloud Environment
Jnaapti
 
Virtual Infrastructure
Bryan McLellan
 
Preparation study of_docker - (MOSG)
Soshi Nemoto
 
Automate drupal deployments with linux containers, docker and vagrant
Ricardo Amaro
 
How to Install KVM (Kernel-based Virtual Machine) on Debian 12
Green Webpage
 
Containerizing your Security Operations Center
Jimmy Mesta
 
OpenStack Murano introduction
Victor Zhang
 
Continuous Integration: SaaS vs Jenkins in Cloud
Ideato
 
Monitoring kubernetes with prometheus
Brice Fernandes
 
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
KVM tools and enterprise usage
vincentvdk
 
Embacing service-level-objectives of your microservices in your Cl/CD
Nebulaworks
 
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
Ad

Recently uploaded (20)

PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
IObit Driver Booster Pro 12.4.0.585 Crack Free Download
henryc1122g
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PDF
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
NSF Converter Simplified: From Complexity to Clarity
Johnsena Crook
 
PDF
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
IObit Driver Booster Pro 12.4.0.585 Crack Free Download
henryc1122g
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
NSF Converter Simplified: From Complexity to Clarity
Johnsena Crook
 
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Ad

OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu Anayanwu