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

NETWAYS
NETWAYSNETWAYS
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
1 von 36

Recomendados

Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code von
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeIsrael Shirk
75 views27 Folien
Introduction to telepresence von
Introduction to telepresenceIntroduction to telepresence
Introduction to telepresenceKyohei Mizumoto
511 views25 Folien
ConcourseCi overview von
ConcourseCi  overviewConcourseCi  overview
ConcourseCi overviewGwenn Etourneau
3.1K views60 Folien
End-to-end CI/CD deployments of containerized applications using AWS services von
End-to-end CI/CD deployments of containerized applications using AWS servicesEnd-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS servicesMassimo Ferre'
856 views17 Folien
Comandos - Evento - Virtual Lab Despliegue de aplicaciones en Kubernetes von
Comandos - Evento - Virtual Lab Despliegue de aplicaciones en KubernetesComandos - Evento - Virtual Lab Despliegue de aplicaciones en Kubernetes
Comandos - Evento - Virtual Lab Despliegue de aplicaciones en KubernetesJulio Pari
112 views1 Folie
Simplestack von
SimplestackSimplestack
SimplestackWillian Molinari
629 views37 Folien

Más contenido relacionado

Was ist angesagt?

PHP-VCR behat case study von
PHP-VCR behat case studyPHP-VCR behat case study
PHP-VCR behat case studyPascal Thormeier
30.9K views28 Folien
CI-CD WITH GITLAB WORKFLOW von
CI-CD WITH GITLAB WORKFLOWCI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOWAddWeb Solution Pvt. Ltd.
129 views9 Folien
Very Early Review - Rocket(CoreOS) von
Very Early Review - Rocket(CoreOS)Very Early Review - Rocket(CoreOS)
Very Early Review - Rocket(CoreOS)충섭 김
4.1K views26 Folien
Ops for NoOps - Operational Challenges for Serverless Apps von
Ops for NoOps - Operational Challenges for Serverless AppsOps for NoOps - Operational Challenges for Serverless Apps
Ops for NoOps - Operational Challenges for Serverless AppsErica Windisch
2K views19 Folien
Automatic docker service announcement with registrator and confd von
Automatic docker service announcement with registrator and confdAutomatic docker service announcement with registrator and confd
Automatic docker service announcement with registrator and confd충섭 김
2.9K views17 Folien
Gitlab - Creating C++ applications with Gitlab CI von
Gitlab - Creating C++ applications with Gitlab CIGitlab - Creating C++ applications with Gitlab CI
Gitlab - Creating C++ applications with Gitlab CIUilian Ries
11K views45 Folien

Was ist angesagt?(20)

Very Early Review - Rocket(CoreOS) von 충섭 김
Very Early Review - Rocket(CoreOS)Very Early Review - Rocket(CoreOS)
Very Early Review - Rocket(CoreOS)
충섭 김4.1K views
Ops for NoOps - Operational Challenges for Serverless Apps von Erica Windisch
Ops for NoOps - Operational Challenges for Serverless AppsOps for NoOps - Operational Challenges for Serverless Apps
Ops for NoOps - Operational Challenges for Serverless Apps
Erica Windisch2K views
Automatic docker service announcement with registrator and confd von 충섭 김
Automatic docker service announcement with registrator and confdAutomatic docker service announcement with registrator and confd
Automatic docker service announcement with registrator and confd
충섭 김2.9K views
Gitlab - Creating C++ applications with Gitlab CI von Uilian Ries
Gitlab - Creating C++ applications with Gitlab CIGitlab - Creating C++ applications with Gitlab CI
Gitlab - Creating C++ applications with Gitlab CI
Uilian Ries11K views
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra... von Develcz
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Develcz116 views
Composer - Panada Conference 2014 von Mulia Nasution
Composer - Panada Conference 2014Composer - Panada Conference 2014
Composer - Panada Conference 2014
Mulia Nasution551 views
Building Composable Serverless Apps with IOpipe von Erica Windisch
Building Composable Serverless Apps with IOpipe Building Composable Serverless Apps with IOpipe
Building Composable Serverless Apps with IOpipe
Erica Windisch456 views
Understanding kube proxy in ipvs mode von Victor Morales
Understanding kube proxy in ipvs modeUnderstanding kube proxy in ipvs mode
Understanding kube proxy in ipvs mode
Victor Morales587 views
Ci For The Web 2.0 Guy Or Gal von Chad Woolley
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
Chad Woolley2.3K views
Node.js kubernetes-cloud all the buzzwords coming together with microsoft azure von Patriek van Dorp
Node.js kubernetes-cloud all the buzzwords coming together with microsoft azureNode.js kubernetes-cloud all the buzzwords coming together with microsoft azure
Node.js kubernetes-cloud all the buzzwords coming together with microsoft azure
Patriek van Dorp372 views
"fireap" - fast task runner on consul von IKEDA Kiyoshi
"fireap" - fast task runner on consul"fireap" - fast task runner on consul
"fireap" - fast task runner on consul
IKEDA Kiyoshi2.5K views
grifork - fast propagative task runner - von IKEDA Kiyoshi
grifork - fast propagative task runner -grifork - fast propagative task runner -
grifork - fast propagative task runner -
IKEDA Kiyoshi2.3K views
Capistrano, Puppet, and Chef von David Benjamin
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
David Benjamin10.1K views
Composer Panada Conference 2014 by Mulia Nasution von k4ndar
Composer Panada Conference 2014 by Mulia NasutionComposer Panada Conference 2014 by Mulia Nasution
Composer Panada Conference 2014 by Mulia Nasution
k4ndar1.6K views

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

Comando kvm terminal von
Comando kvm terminalComando kvm terminal
Comando kvm terminalCarlos Eduardo
1K views4 Folien
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide von
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideRapidValue
2.8K views15 Folien
Krenel Based Virtual Machine In Centos7 von
Krenel Based Virtual Machine In Centos7Krenel Based Virtual Machine In Centos7
Krenel Based Virtual Machine In Centos7a_ratra
112 views14 Folien
Kubernetes laravel and kubernetes von
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetesWilliam Stewart
3.4K views28 Folien
Create Development and Production Environments with Vagrant von
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantBrian Hogan
3.5K views43 Folien
Deploying Symfony | symfony.cat von
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
2.8K views149 Folien

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

AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide von RapidValue
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
RapidValue2.8K views
Krenel Based Virtual Machine In Centos7 von a_ratra
Krenel Based Virtual Machine In Centos7Krenel Based Virtual Machine In Centos7
Krenel Based Virtual Machine In Centos7
a_ratra112 views
Kubernetes laravel and kubernetes von William Stewart
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
William Stewart3.4K views
Create Development and Production Environments with Vagrant von Brian Hogan
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
Brian Hogan3.5K views
Deploying Symfony | symfony.cat von Pablo Godel
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel2.8K views
Building your own Desktop Cloud Environment von Jnaapti
Building your own Desktop Cloud EnvironmentBuilding your own Desktop Cloud Environment
Building your own Desktop Cloud Environment
Jnaapti4.7K views
Preparation study of_docker - (MOSG) von Soshi Nemoto
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
Soshi Nemoto597 views
Automate drupal deployments with linux containers, docker and vagrant von Ricardo Amaro
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
Ricardo Amaro9.8K views
Containerizing your Security Operations Center von Jimmy Mesta
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations Center
Jimmy Mesta985 views
OpenStack Murano introduction von Victor Zhang
OpenStack Murano introductionOpenStack Murano introduction
OpenStack Murano introduction
Victor Zhang6.3K views
Continuous Integration: SaaS vs Jenkins in Cloud von Ideato
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in Cloud
Ideato12.1K views
Monitoring kubernetes with prometheus von Brice Fernandes
Monitoring kubernetes with prometheusMonitoring kubernetes with prometheus
Monitoring kubernetes with prometheus
Brice Fernandes1.2K views
Continuous Delivery: The Next Frontier von Carlos Sanchez
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
Carlos Sanchez1.6K views
KVM tools and enterprise usage von vincentvdk
KVM tools and enterprise usageKVM tools and enterprise usage
KVM tools and enterprise usage
vincentvdk5K views
Embacing service-level-objectives of your microservices in your Cl/CD von Nebulaworks
Embacing service-level-objectives of your microservices in your Cl/CDEmbacing service-level-objectives of your microservices in your Cl/CD
Embacing service-level-objectives of your microservices in your Cl/CD
Nebulaworks114 views
Running Docker in Development & Production (#ndcoslo 2015) von Ben Hall
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall12.6K views
Vm_Commit or How to Easily Handle An Infinite Number of Versions of Running Q... von Dominique Rodrigues
Vm_Commit or How to Easily Handle An Infinite Number of Versions of Running Q...Vm_Commit or How to Easily Handle An Infinite Number of Versions of Running Q...
Vm_Commit or How to Easily Handle An Infinite Number of Versions of Running Q...

Último

Introduction to Git Source Control von
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source ControlJohn Valentino
5 views18 Folien
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium... von
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...Lisi Hocke
35 views124 Folien
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports von
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsRa'Fat Al-Msie'deen
8 views49 Folien
SAP FOR TYRE INDUSTRY.pdf von
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdfVirendra Rai, PMP
24 views3 Folien
EV Charging App Case von
EV Charging App Case EV Charging App Case
EV Charging App Case iCoderz Solutions
5 views1 Folie
Bootstrapping vs Venture Capital.pptx von
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptxZeljko Svedic
12 views17 Folien

Último(20)

Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium... von Lisi Hocke
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Lisi Hocke35 views
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports von Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
Bootstrapping vs Venture Capital.pptx von Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic12 views
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action von Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok6 views
predicting-m3-devopsconMunich-2023.pptx von Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app7 views
Generic or specific? Making sensible software design decisions von Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... von TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... von NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi212 views
Ports-and-Adapters Architecture for Embedded HMI von Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert21 views

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