qcon 2015 uma abordagem pr tica ao lxc
play

QCON 2015 Uma abordagem prtica ao LXC UOLHOST Marcus Vincius - PowerPoint PPT Presentation

QCON 2015 Uma abordagem prtica ao LXC UOLHOST Marcus Vincius Soares mvc_msoares@uolinc.com Agenda Motivao LXC GO Dicas Perguntas e Respostas Complexidade Atual Complexidade atual (e crescendo) CAOS Version


  1. QCON 2015 Uma abordagem prática ao LXC UOLHOST Marcus Vinícius Soares mvc_msoares@uolinc.com

  2. Agenda • Motivação • LXC • GO • Dicas • Perguntas e Respostas

  3. Complexidade Atual

  4. Complexidade atual (e crescendo)

  5. CAOS • Version spawn • DEV / QA / Pre-Prod / Prod • Continuos Integration • Continuous Deployment

  6. História • Virtualização • Servidores • Rede • Storage • Aplicações – BINGO!!!

  7. Virtualização de Servidores • Benefícios amplamente conhecidos • Mas.... – Tempo de provisionamento – Quantidade de VM's – Provisionamento Dinâmico – HPC performance – Burocracia interna

  8. LXC – LinuX Containers • Idéia não é nova : Jail / Zones / IBM / HP Modelo Tradicional com Máquina Virtual LXC Style

  9. LXC • “Cgroups on steroids” • Ligthweight • Agilidade e Flexibilidade • Compartimentação • Open source / Custo • Larga adoção • HPC ready • Cloud stlye • Kernel Version

  10. LXC Kernel Namespaces Seccomp Cgroups policies LXC AppArmor chroot & SELinux

  11. LXC Sistema Tunnable blkio - Weighted proportional block I/O access. Group wide or per device. - Per device hard limits on block I/O read/write specified as bytes per second or IOPS per second. cpu - Time period (microseconds per second) a group should have CPU access. - Group wide upper limit on CPU time per second. - Weighted proportional value of relative CPU time for a group. cpuset - CPUs (cores) the group can access. - Memory nodes the group can access and migrate ability. - Memory hardwall, pressure, spread, etc. devices - Define which devices and access type a group can use. freezer - Suspend/resume group tasks. memory - Max memory limits for the group (in bytes). - Memory swappiness, OOM control, hierarchy, etc.. hugetlb - Limit HugeTLB size usage. - Per cgroup HugeTLB metrics. net_cls - Tag network packets with a class ID. - Use tc to prioritize tagged packets. net_prio - Weighted proportional priority on egress traffic (per interface).

  12. LXC – Colocando para Funcionar • Como fazer um server funcionar? – Instalar os pacotes – Config (rede / fs / memória / processador ) – RootFS ( images ) – LXC Tools

  13. LXC – Pacotes • RPM Based (Centos/RedHat etc) – yum install libvirt libvirt-client python-virtinst • Deb Based (Debian / Ubuntu / etc) – sudo apt-get install lxc • Enable cgroups – none /cgroup cgroup defaults 0 0

  14. LXC – Config • Configurações dos recursos utilizados pelo container – Rede – Rootfs – Limitações – Mount binds – Segurança

  15. LXC – Cgroups pseudofs

  16. LXC – Config • • lxc.tty = 1 lxc.network.0.type = veth • • lxc.utsname = b:u:inthosp:1 lxc.network.0.flags = up • • lxc.pivotdir = mnt lxc.network.0.link = br0 • • lxc.rootfs = lxc.network.0.name = eth1 /opt/phoenix/var/slot/b-u- • lxc.network.0.mtu = 1500 inthosp-1/rootfs • lxc.network.0.ipv4 = • lxc.cgroup.cpu.shares = 1024 10.1.0.41/16 • lxc.cgroup.cpu.cfs_period_us • lxc.network.0.veth.pair = = 100000 veth40 • lxc.cgroup.cpu.cfs_quota_us • lxc.cgroup.devices.deny = a = 100000 • lxc.cgroup.memory.limit_in_b ytes = 256M • lxc.cgroup.memory.memsw.limi t_in_bytes = 256M • lxc.mount.entry = proc proc proc nosuid,nodev,noexec 0 0

  17. LXC – Images • Sua “ISO“ • Read-only para o container • Shared • Como gerar � Docker dclient = docker.Client(base_url=docker_url,version='1.16',timeout=120) container = dclient.create_container(base, "/usr/bin/python -u /mnt/build/docker-template-setup.py", volumes=["/mnt/build", "/var/cache/yum"], name="build-%s" % pkg) ... resp = dclient.export(container) tar = subprocess.Popen(["/bin/tar", "-x", "-C", imagedir], stdin=subprocess.PIPE) ... .SPEC para gerar o RPM

  18. LXC – Images

  19. LXC – Tools • lxc-create -n shimoo-c -t debian • lxc-start –n shimmo-c • lxc-attach –n shimmo-c

  20. LXC – Dicas • Abstrair • Kernel updates !! – Vários erros no OOM durante o processo • Kernel Debug – Tenha seu kernel em debug mode em prod – Kdump habilitado até ter certeza • Testing...testing...more testing • Overcommit ... A lot • IT WORKS!!!

  21. LXC Commoditization: docker • Desacoplamento • Agnóstico • Imagens rodam em qualquer plataforma suportada pelo Docker • Portabilidade • Larga Adoção – muito fácil • Sharing • Integrações

  22. Docker vs. LXC vs. Hypervisor

  23. GO • New • https://golang.org/ • Funny

  24. GO Camada de WS de alto nível para provisionar seu container: • • curl -si \ -H "Host: shimoo.com.br" \ -H "X-User: shimoo" \ -H "X-User-Domains: shimoo.com.br" \ -H "X-Homedir: ha-pool02/ha-pool02-fs02/shimoo/home" \ -H "X-Application: tomcat8;jdk=8" \ -H "X-Instance: 1" \ -H "X-Memory-Limit: 256" \ -H "X-CPU-Limit: 25" \ -H "X-Idle-Timout: 5" \ -H "X-Backend: b:u:shimoo:1" \ -H "X-Realhost: shimoo.com.br" \ http://localhost

  25. Perguntas Marcus Vinícius Soares mvc_msoares@uolinc.com

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend