KataContainer:云原生虚拟化技术探究

发布于 2020-10-25 · 本文总共 3168 字 · 阅读大约需要 10 分钟

The speed of containers, the security of VMs

快如容器,稳(安全)如虚拟机;

Kata Container

Kata Containers is an open source community working to build a secure container runtime with lightweight virtual machines that feel and perform like containers, but provide stronger workload isolation using hardware virtualization technology as a second layer of defense.

Since launching in December 2017, the community successfully merged the best parts of Intel Clear Containers with Hyper.sh RunV and scaled to include support for major architectures including AMD64, ARM, IBM p-series and IBM z-series in addition to x86_64. Kata Containers also supports multiple hypervisors including QEMU, NEMU and Firecracker and integrates with the containerd project among others.

The Kata Containers community is stewarded by the Open Infrastructure Foundation, which supports the development and adoption of open infrastructure globally. The code is hosted at GitHub under the Apache 2 license.

历史

2013年,Docker问世;

尽管容器有很多技术优势;

但容器由于与宿主机共享内核,这可能会引发严重的安全漏洞问题;

理论上,如果在单个主机上部署了多个容器,一旦其中某个容器被恶意代码利用, 由于共享namespace,该主机上的其他所有容器也容易受到攻击, 在这种情况下,可能会对云基础设施整体构成严重的安全威胁; 对于云供应商,安全威胁可能会扩展到云端客户的数据和业务,这是绝对要避免的;

Intel 和 Hyper.sh的开发人员意识到了这个问题,同时开始独立研发解决方案,两家公司都希望容器可以摆脱传统虚机的所有包袱, 换言之,就是开发“面向云原生的虚拟化”技术:

来自Intel开源技术中心的工程师在 Intel Clear Containers项目中运用 Intel Virtualization Technology(Intel VT)技术来强化性能和安全隔离;

与此同时,Hyper.sh的工程师采用相似的策略启动了开源项目runV,将容器放在一个安全“沙箱”中, 通过支持多种CPU架构和管理程序,侧重于开发技术中立的解决方案;

2017年,两家公司将项目合并,互为补充,创建了开源项目 Kata Containers

特性

Kata Container的最大亮点是 让每个容器运行在一个轻量级的虚拟机中; 解决了传统容器共享内核的安全和隔离问题;

Security-安全性

Runs in a dedicated kernel, providing isolation of network, I/O and memory and can utilize hardware-enforced isolation with virtualization VT extensions.

Compatibility-兼容性

Supports industry standards including OCI container format, Kubernetes CRI interface, as well as legacy virtualization technologies.

Performance-性能

Delivers consistent performance as standard Linux containers; increased isolation without the performance tax of standard virtual machines.

Simplicity-易用性

Eliminates the requirement for nesting containers inside full blown virtual machines; standard interfaces make it easy to plug in and get started.

架构

Kata Container是两个开源项目的合并:Intel Clear Containers和Hyper runV;

Intel Clear Containers

通过Intel虚拟化技术(VT)解决容器内部的安全问题,并且能够将容器作为轻量级虚拟机(VM)启动,提供了一个可选的运行时间,专注于性能(<100ms启动时间), 可与Kubernetes和Docker等常用容器环境互操作;

~安全性和性能不必是一个折衷,将硬件隔离的安全性与容器的性能可以兼得~

Hyper runV

hyper runV优先于技术无关支持许多不同的CPU架构和管理程序。

主要组件

katacontainer

kata-runtime

运行在宿主机上;

OCI兼容的容器运行时,负责处理OCI运行时规范指定的所有命令并启动kata-shim实例;

kata-shim

运行在宿主机上,监控容器进程,处理容器的所有I/O流;

kata-proxy

通信组件; 默认使用virtio-serial和VM通信; VM可以运行多个容器进程;

在每个kata-shim和kata-agent之间路由I/O流和信号;

给多个kata-shim和kata-runtime客户端提供对kata-agent提供访问;

kata-agent

运行在gust中,作为超级管理员,管理容器和容器中的进程;

与其他kata组件通过gRPC协议通信;

Docker与katacontainer

Docker的安全性

使用Docker轻量级的容器时,最大的问题就是会碰到安全性的问题,其中几个不同的容器可以互相的进行攻击,如果把这个内核给攻掉了,其他所有容器都会崩溃。 如果使用KVM等虚拟化技术,会完美解决安全性的问题,但响应的性能会受到一定的影响。

单单就Docker来说,安全性可以概括为两点:

  • 不会对主机造成影响

  • 不会对其他容器造成影响,所以安全性问题90%以上可以归结为隔离性问题。

而Docker的安全问题本质上就是容器技术的安全性问题,这包括共用内核问题以及Namespace还不够完善的限制:

  1. /proc、/sys等未完全隔离

  2. Top, free, iostat等命令展示的信息未隔离

  3. Root用户未隔离

  4. /dev设备未隔离

  5. 内核模块未隔离

  6. SELinux、time、syslog等所有现有Namespace之外的信息都未隔离

当然,镜像本身不安全也会导致安全性问题。

实践

使用katacontainer安装Docker

katacontainer kubernetes集成安装

refs

https://katacontainers.io/

Kata Containers: 面向云原生的虚拟化2

Kata Containers: 两年而立3

Kata Containers: 2.0的蓝图4

https://thenewstack.io/the-road-to-kata-containers-2-0/

https://blog.csdn.net/zhonglinzhang/article/details/86489695




本博客所有文章采用的授权方式为 自由转载-非商用-非衍生-保持署名 ,转载请务必注明出处,谢谢。
声明:
本博客欢迎转发,但请保留原作者信息!
博客地址:邱文奇(qiuwenqi)的博客;
内容系本人学习、研究和总结,如有雷同,实属荣幸!
阅读次数:

文章评论

comments powered by Disqus


章节列表