├── .gitignore ├── README.md ├── archetypes └── default.md ├── config.toml ├── content ├── _index.md ├── bpf │ ├── _index.md │ ├── index.md │ └── reference.md ├── go │ ├── _index.md │ ├── images │ │ ├── envoy_go.png │ │ ├── go_ext_arch3.png │ │ └── ondata.png │ └── index.md └── introduction │ ├── _index.md │ ├── concept.md │ ├── images │ ├── cilium-arch.png │ ├── cilium-connectivity.jpg │ ├── cilium-ecosystem.jpg │ └── cilium-logo.svg │ ├── index.md │ ├── information.md │ └── releases.md └── static ├── google5713250934492ab9.html └── images ├── favicon.ico └── logo.png /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | !.gitignore 3 | public/ 4 | themes/ 5 | update_theme.sh 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cilium学习笔记 2 | 3 | ![](content/introduction/images/cilium-logo.svg) 4 | 5 | ### 内容介绍 6 | 7 | Cilium是一个开源软件,用于透明地提供和保护使用Kubernetes,Docker和Mesos等Linux容器管理平台部署的应用程序服务之间的网络和API连接。 8 | 9 | ![](content/introduction/images/cilium-connectivity.jpg) 10 | 11 | Cilium基于一种名为BPF的新Linux内核技术,它可以在Linux内部动态插入强大的安全性,可见性和网络控制逻辑。 除了提供传统的网络级安全性之外,BPF的灵活性还可以在API和进程级别上实现安全性,以保护容器或容器内的通信。由于BPF在Linux内核中运行,因此可以应用和更新Cilium安全策略,而无需对应用程序代码或容器配置进行任何更改。 12 | 13 | ### 访问方式 14 | 15 | 这是个人学习Cilium的笔记,请点击下面的链接阅读: 16 | 17 | - [在线阅读](https://skyao.io/learning-cilium/):hugo格式,界面清爽。托管于腾讯云香港节点,速度快,偶尔抽风 18 | - [@github](https://github.com/skyao/learning-cilium/):源码托管于github,如有谬误或需讨论,请提issue,欢迎提交PR 19 | 20 | ### 版权申明 21 | 22 | 本笔记内容可以任意转载,但请注明来源并提供链接,**请勿用于商业出版**。 23 | 24 | ### 格式说明 25 | 26 | 笔记原是基于gitbook构建,由于gitbook本地编辑时生成内容的速度太慢,而gitbook网站的访问速度不理想,还经常被墙。 27 | 28 | 因此不得已改为hugo格式并独立托管。gitbook上不再生成内容,只保留链接信息以供跳转,请使用在线阅读方式。 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /config.toml: -------------------------------------------------------------------------------- 1 | baseurl = "http://localhost:1313/" 2 | languageCode = "en-us" 3 | uglyurls = true 4 | relativeURLs = true 5 | title = "Cilium学习笔记" 6 | theme = "hugo-material-docs" 7 | metadataformat = "yaml" 8 | canonifyurls = true 9 | preserveTaxonomyNames = true 10 | disablePathToLower = true 11 | 12 | # Enable Google Analytics by entering your tracking id 13 | googleAnalytics = "c7442f5794ea2abb71c6ff05dc0b8779" 14 | 15 | [params] 16 | # General information 17 | author = "敖小剑" 18 | keywords = "cilium,BPF,eBPF,学习笔记,敖小剑" 19 | description = "Cilium是一个开源软件,用于透明地提供和保护使用Kubernetes,Docker和Mesos等Linux容器管理平台部署的应用程序服务之间的网络和API连接。" 20 | copyright = "版权所有,转载请注明出处" 21 | 22 | # Repository 23 | provider = "GitHub" 24 | repo_url = "https://github.com/skyao/learning-cilium" 25 | 26 | version = "" 27 | logo = "images/logo.png" 28 | favicon = "" 29 | 30 | permalink = "#" 31 | 32 | # reward button, comment this to disable it 33 | reward = true 34 | 35 | # Custom assets 36 | custom_css = [] 37 | custom_js = [] 38 | 39 | # Syntax highlighting theme 40 | highlight_css = "" 41 | 42 | [params.palette] 43 | primary = "red" 44 | accent = "teal" 45 | 46 | [params.font] 47 | text = "Ubuntu" 48 | code = "Ubuntu Mono" 49 | 50 | [social] 51 | twitter = "" 52 | github = "skyao" 53 | email = "aoxiaojian@gmail.com" 54 | 55 | 56 | [[menu.main]] 57 | name = "前言" 58 | url = "/" 59 | weight = 1 60 | 61 | [[menu.main]] 62 | name = "介绍" 63 | identifier = "introduction" 64 | url = "/introduction/" 65 | weight = 100 66 | 67 | [[menu.main]] 68 | name = "BPF" 69 | identifier = "bpf" 70 | url = "/bpf/" 71 | weight = 300 72 | 73 | [[menu.main]] 74 | name = "Go Extension" 75 | identifier = "go" 76 | url = "/go/" 77 | weight = 800 78 | 79 | [blackfriday] 80 | smartypants = true 81 | fractions = true 82 | smartDashes = true 83 | plainIDAnchors = true -------------------------------------------------------------------------------- /content/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-09-08T21:07:13+08:00 3 | title: 前言 4 | weight: 1 5 | keywords: 6 | - cilium 7 | - BPF 8 | - eBPF 9 | - 学习笔记 10 | description : "介绍Cilium学习笔记的基本资料和访问方式" 11 | --- 12 | 13 | ![](introduction/images/cilium-logo.svg) 14 | 15 | ### 内容介绍 16 | 17 | Cilium是一个开源软件,用于透明地提供和保护使用Kubernetes,Docker和Mesos等Linux容器管理平台部署的应用程序服务之间的网络和API连接。 18 | 19 | ![](introduction/images/cilium-connectivity.jpg) 20 | 21 | Cilium基于一种名为BPF的新Linux内核技术,它可以在Linux内部动态插入强大的安全性,可见性和网络控制逻辑。 除了提供传统的网络级安全性之外,BPF的灵活性还可以在API和进程级别上实现安全性,以保护容器或容器内的通信。由于BPF在Linux内核中运行,因此可以应用和更新Cilium安全策略,而无需对应用程序代码或容器配置进行任何更改。 22 | 23 | ### 访问方式 24 | 25 | 这是个人学习Cilium的笔记,请点击下面的链接阅读: 26 | 27 | - [在线阅读](https://skyao.io/learning-cilium/):hugo格式,界面清爽。托管于腾讯云香港节点,速度快,偶尔抽风 28 | - [@github](https://github.com/skyao/learning-cilium/):源码托管于github,如有谬误或需讨论,请提issue,欢迎提交PR 29 | 30 | ### 版权申明 31 | 32 | 本笔记内容可以任意转载,但请注明来源并提供链接,**请勿用于商业出版**。 33 | 34 | 35 | -------------------------------------------------------------------------------- /content/bpf/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 0 3 | --- 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /content/bpf/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-09-10T21:07:13+08:00 3 | title: BPF 4 | weight: 300 5 | keywords: 6 | - BPF 7 | - eBPF 8 | description : "BPF介绍" 9 | --- 10 | 11 | ## 12 | 13 | -------------------------------------------------------------------------------- /content/bpf/reference.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-09-18T21:07:13+08:00 3 | title: BPF和XDP参考指南 4 | weight: 320 5 | menu: 6 | main: 7 | parent: "bpf" 8 | keywords: 9 | - BPF 10 | - XDP 11 | - Reference 12 | description : "BPF和XDP参考指南中文翻译" 13 | --- 14 | 15 | > 说明: 16 | > 17 | > 内容来自cilium官方文档 [BPF and XDP Reference Guide](https://cilium.readthedocs.io/en/v1.2/bpf/) 。因为原文实在太长,只翻译了其中少量部分。 18 | 19 | BPF是Linux内核中一种高度灵活和高效的虚拟机类构造,允许以安全的方式在各个挂钩点执行字节码。 它用于许多Linux内核子系统,最突出的是网络,跟踪和安全性(例如沙盒)。 20 | 21 | 尽管BPF自1992年以来一直存在,但本文档涵盖了扩展的Berkeley Packet Filter (eBPF)版本,该版本最初出现在内核3.18中,并且现在被称为“经典”BPF(cBPF)的原始版本大多已经过时。许多人都知道`cBPF`是`tcpdump`使用的包过滤语言。如今,Linux内核仅运行`eBPF`,并且加载的cBPF字节码会在程序执行之前被透明地转换为内核中的eBPF表示。 除非指出eBPF和cBPF之间存在明显差异,否则本文档通常会引用术语BPF。 22 | 23 | 尽管Berkeley Packet Filter这个名称暗示了数据包过滤的特定用途,但是这些指令集足够通用而灵活,除了网络之外还有许多BPF用例。有关使用BPF的项目列表,请参阅[Further Reading](https://cilium.readthedocs.io/en/v1.2/bpf/#bpf-users)。 24 | 25 | Cilium在其数据路径中重度使用BPF,有关详细信息,请参阅 [概念](../../introduction/concept/)。 本章的目标是提供BPF参考指南,以便了解BPF,其网络特定用途,包括使用tc(traffic control)和XDP(eXpress Data Path)加载BPF程序,以及帮助开发Cilium的BPF模板。 26 | 27 | ## BPF架构 28 | 29 | BPF不仅通过提供其指令集来定义自己,而且还通过提供更多的周边基础设施来定义自己,例如充当有效键/值存储的map,与内核功能交互并利用内核功能的辅助函数,调用其他BPF程序的尾调用 ,安全加固原语,用于固定对象(maps,programs)的伪文件系统,以及允许将BPF卸载到比如网卡的基础设置。 30 | 31 | LLVM提供BPF后端,因此像clang这样的工具可以用来将C编译成BPF目标文件,然后可以将其加载到内核中。BPF与Linux内核密切相关,可在不牺牲原生内核性能的情况下实现完全可编程性。 32 | 33 | 最后但同样重要的是,使用BPF的内核子系统也是BPF基础设施的一部分。本文档中讨论的两个主要子系统是tc和XDP,这些可以附加BPF程序。XDP BPF程序在最早的网络驱动程序阶段附加,并在数据包接收时触发BPF程序的运行。根据定义,这实现了最佳的包处理性能,因为包不能在软件中更早的时间点处理。但是,由于此处理在网络堆栈中如此早地发生,因此堆栈尚未从数据包中提取元数据。另一方面,tc BPF程序稍后在内核堆栈中执行,因此它们可以访问更多元数据和核心内核功能。除了tc和XDP程序之外,还有各种其他内核子系统,它们使用BPF,例如跟踪(kprobes,uprobes,tracepoints等)。 34 | 35 | 以下小节提供了有关BPF架构各个方面的更多详细信息。 36 | 37 | ### 指令集 38 | 39 | BPF是一个通用的RISC指令集,最初设计用于在C的子集中编写程序,可以通过编译器后端(例如LLVM)将其编译为BPF指令,以便内核可以在以后通过内核中的JIT编译器映射它们到原生操作码中,以在内核中实现最佳执行性能。 40 | 41 | 将这些指令推送到内核中的优点包括: 42 | 43 | - 使内核可编程而无需跨越内核/用户空间边界。例如,与网络相关的BPF程序,比如Cilium,可以实现灵活的容器策略,负载均衡和其他方法,而无需将数据包移动到用户空间并返回内核。BPF程序和内核/用户空间之间的状态仍然可以在需要时通过maps共享。 44 | - 考虑到可编程数据路径的灵活性,程序可以通过编译掉用例不需要的功能来极大优化性能。例如,如果容器不需要IPv4,则可以构建BPF程序以仅处理IPv6以便在快速路径中节省资源。 45 | - 在网络(如tc和XDP)的情况下,BPF程序可以原子方式更新,而不必重新启动内核,系统服务或容器,并且不会出现流量中断。此外,还可以通过BPF maps在整个更新过程中维护任何程序状态。 46 | - BPF为用户空间提供稳定的ABI,不需要任何第三方内核模块。BPF是Linux内核的核心部分,随处可见,并保证现有BPF程序继续运行在较新的内核版本上。此保证与内核提供用户空间应用程序的系统调用的保证相同。此外,BPF程序可跨不同架构移植。 47 | - BPF程序与内核协同工作,它们利用现有的内核基础结构(例如驱动程序,网络设备,隧道,协议栈,套接字)和工具(例如iproute2)以及内核提供的安全保证。与内核模块不同,BPF程序通过内核验证程序进行验证,以确保它们不会崩溃内核,始终终止等。例如,XDP程序重用现有的内核内驱动程序并对提供的包含数据包帧的DMA缓冲区进行操作,而不像在其他模型中那样将他们或者整个驱动程序暴露给用户空间。此外,XDP程序重用现有的堆栈而不是绕过它。BPF可以被认为是内核工具的通用“粘合代码”,用于制作解决特定用例的程序。 48 | 49 | 在内核中执行BPF程序始终是事件驱动的! 例如,在ingress路径上附加了BPF程序的网络设备将在接收到数据包后触发程序的执行,具有附加BPF程序的kprobes的内核地址将在该地址处的代码获得执行后捕获(trap),然后调用kprobes回调函数进行检测,随后触发执行附加到它的BPF程序。 50 | 51 | > 备注:此处指令集的细节内容忽略,请见原文。后续也会有大段内容忽略,不再提示。 52 | 53 | ### 辅助函数 54 | 55 | 辅助函数是一个概念,它使BPF程序能够查询核心内核定义的函数调用集,以便从/向内核检索/推送数据。对于每种BPF程序类型,可用的辅助函数可能不同,例如,与附加到tc层的BPF程序相比,附加到套接字的BPF程序仅允许调用辅助程序子集。用于轻量级隧道的封装和解封装助手构成了仅可用于较低tc层的功能的示例,而用于将通知推送到用户空间的事件输出助手可用于tc和XDP程序。 56 | 57 | ### Maps 58 | 59 | map是驻留在内核空间中的高效键/值存储。 可以从BPF程序访问它们,以便在多个BPF程序调用之间保持状态。它们也可以通过用户空间的文件描述符进行访问,并且可以与其他BPF程序或用户空间应用程序任意共享。 60 | 61 | 彼此共享mac的BPF程序不需要具有相同的程序类型,例如,跟踪程序可以与网络程序共享map。 单个BPF程序目前可以直接访问多达64个不同的map。 62 | 63 | map实现由核心内核提供。 存在可以读/写任意数据的具有每CPU和非每CPU风格的通用map,但是也存在一些与辅助函数一起使用的非泛型map。 64 | 65 | ### 对象固定 66 | 67 | 。。。。。。 68 | 69 | ## 编程类型 70 | 71 | 在撰写本文时,有18种不同的BPF程序类型,网络的两种主要类型在下面的小节中进一步说明,即XDP BPF程序以及tc BPF程序。 LLVM,iproute2或其他工具的这两种程序类型的大量使用示例遍布整个工具链部分,此处不再介绍。 相反,本节重点介绍其架构,概念和用例。 72 | 73 | ### XDP 74 | 75 | XDP代表eXpress Data Path,为BPF提供框架,支持Linux内核中的高性能可编程数据包处理。它在软件中尽可能早地运行BPF程序,即在网络驱动程序接收数据包时。 76 | 77 | 此时,在快速路径中,驱动程序只是从其接收环中拾取数据包,而没有进行任何昂贵的操作,例如分配`skb`以便将数据包进一步推送到网络堆栈,也无需将数据包推入GRO引擎。因此,XDP BPF程序在CPU可用于处理的最早时刻执行。 78 | 79 | XDP与Linux内核及其基础设施协同工作,这意味着内核不会像仅在用户空间中运行的各种网络框架那样被绕过。将数据包保留在内核空间中有几个主要优点: 80 | 81 | - XDP能够重用所有上游开发的内核网络驱动程序,用户空间工具,甚至其他可用的内核基础设施,如路由表,套接字等。 82 | - 驻留在内核空间中,XDP与内核的其余部分具有相同的安全模型,用于访问硬件。 83 | - 不需要跨越内核/用户空间边界,因为已处理的数据包已经驻留在内核中,因此可以灵活地将数据包转发到其他内核实体,例如容器或内核的网络堆栈本身使用的命名空间。这在Meltdown和Spectre时期特别相关。 84 | - 将数据包从XDP发送到内核的强大,广泛使用且高效的TCP/IP堆栈是非常可能的,允许完全重用,并且不需要像用户空间框架那样维护单独的TCP/IP堆栈。 85 | - BPF的使用允许完全可编程性,保持稳定的ABI与内核的系统调用ABI具有相同的“永不中断用户空间”保证,并且与模块相比,它还提供安全措施,这要归功于BPF验证器确保内核操作的稳定性。 86 | - XDP通常允许在运行时自动交换程序,而不会出现任何网络流量中断甚至内核/系统重启。 87 | - XDP允许灵活地构建集成到内核中的工作负载。 例如,它可以在“busy polling”或“interrupt driven”模式下操作。不需要将CPU显式专用于XDP。 没有特殊的硬件要求,也不依赖于大页面。 88 | - XDP不需要任何第三方内核模块或许可。它是一个长期的架构解决方案,是Linux内核的核心部分,由内核社区开发。 89 | - 在运行4.8或更高的内核的主要发行版中,已经带有XDP并启用,并支持大多数主要的10G或更高版本的网络驱动程序。 90 | 91 | #### XDP的用例 92 | 93 | 本小节介绍了XDP的一些主要用例。 该列表并非详尽无遗,并且考虑到XDP和BPF的可编程性和效率,可以轻松地对其进行调整以解决非常具体的用例。 94 | 95 | TBD 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /content/go/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 0 3 | --- 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /content/go/images/envoy_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/content/go/images/envoy_go.png -------------------------------------------------------------------------------- /content/go/images/go_ext_arch3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/content/go/images/go_ext_arch3.png -------------------------------------------------------------------------------- /content/go/images/ondata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/content/go/images/ondata.png -------------------------------------------------------------------------------- /content/go/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-08-09T21:07:13+08:00 3 | title: Go Extension 4 | weight: 800 5 | description : "Cilium的Go扩展" 6 | --- 7 | 8 | 2018年10月23日,Cilium发布1.3版本,这个版本最大的亮点是引入了用于 Envoy 的 Go Extension ,并在 Envoy Go Extension的基础上实现了 Cassandra 和 Memcached 的协议解析器。详情见: 9 | 10 | - [Cilium 1.3: Go extensions for Envoy, Cassandra & Memcached Support](https://cilium.io/blog/2018/10/23/cilium-13-envoy-go/) 11 | 12 | ## Envoy Go extensions是什么? 13 | 14 | Cilium一直依赖Envoy来处理HTTP和gRPC,以及自1.0版以来的Elasticsearch等HTTP派生。随着社区讨论如何扩展支持的L7协议的范围,很明显Envoy是推动未来协议添加的正确平台。重点迅速转向寻找简化Envoy可扩展性的方法,并允许重用现有的开源项目,如CNCF项目Vitess。 Envoy的Go扩展的想法诞生了。 15 | 16 | 在Cilium 1.3中,Cilium将Envoy的Go扩展作为Beta功能引入。 17 | 18 | ![](images/go_ext_arch3.png) 19 | 20 | - **透明注入扩展:** 在Cilium的帮助下,连接被透明地重定向到Envoy,而无需修改应用程序或pod。 重定向基于目标端口进行配置,可以根据ingress和egress连接的标签,IP,DNS名称和服务名称限制为源或目标服务,并通过扩展名称映射到扩展的连接。重定向通过CiliumNetworkPolicy CRD或REST API进行配置。Envoy可以配置为在每个pod中作为sidecar运行,也可以作为独立代理运行,每个node一个。 21 | - **完全分布式:** Go扩展是完全分布式的:Go扩展在Envoy内部,而Envoy运行在每个节点上或每个pod内,并且不需要集中式的控制平面进行数据处理。当然,go扩展本身可以调用任意控制平面组件来报告遥测或验证请求。 22 | - **动态扩展映射:** Go扩展可作为共享库提供给Envoy。Cilium将Envoy配置为根据已配置的重定向自动加载相应的Go扩展,并在此连接有数据时调用它。未来版本将支持在运行时更新和重新加载扩展,而无需重新启动Envoy并且不会丢失连接状态。 23 | - **通过CRD扩展配置:** Go扩展通过CRD或REST API使用通用键值对进行配置。这允许传递配置如安全策略,安全令牌或其他配置,而无需让Envoy意识到。 24 | - **通用访问日志记录:** 通用访问日志记录:与配置类似,扩展可以返回通用键值对,这些键将进入访问日志,以允许将提取的可见性传递到访问日志层。 25 | - **沙箱** 沙箱确保任何解析器不稳定都不会破坏Envoy成熟核心的稳定性。 在Matt Klein的帖子Exceptional Go的启发下,解析器被允许panic以引发异常。发生panic时,会将信息记录到访问日志中,并关闭与请求关联的TCP连接。 26 | 27 | ## 如何编写Envoy Go Extension? 28 | 29 | 为Envoy编写扩展很简单。 为了说明这一点,我们将为R2-D2控制协议实现一个基本协议解析器,并实现过滤逻辑以排除包含字符串“C-3PO”的任何控制请求。 30 | 31 | ![](images/envoy_go.png) 32 | 33 | 实现扩展的主要API是 `OnData()` 函数,只要Envoy在通过`CiliumNetworkPolicy`映射到扩展的连接上接收到数据,就会调用该函数。该函数必须解析数据并返回以下判断之一: 34 | 35 | - **MORE:** 解析器需要更多n个字节才能继续解析。 36 | - **PASS:** 传递数据流的n个字节。 37 | - **DROP:** 丢弃数据流的n个字节。 38 | - **INJECT:** 在指定方向上注入n个字节的数据。 39 | - **ERROR:** 发生解析错误,必须关闭连接。 40 | - **NOP:** 什么都不做。 41 | 42 | 为了注册扩展,创建的parse factory必须实现Create()函数。 只要Envoy建立了一个应该使用解析器的新连接,就会调用该函数。 43 | 44 | ```go 45 | import ( 46 | "github.com/cilium/cilium/proxylib/proxylib" 47 | ) 48 | 49 | type parser struct{ 50 | connection *proxylib.Connection 51 | } 52 | 53 | func (p *parser) OnData(reply, endStream bool, dataArray [][]byte) (proxylib.OpType, int) { 54 | data := string(bytes.Join(dataArray, []byte{})) 55 | msgLen := strings.Index(data, "\r\n") 56 | if msgLen < 0 { 57 | return proxylib.MORE, 1 // No delimiter, request more data 58 | } 59 | 60 | msgStr := data[:msgLen] 61 | msgLen += 2 // Inlcude the "\r\n" in the request 62 | 63 | if reply { 64 | return proxylib.PASS, msgLen // Pass responses without additional parsing 65 | } 66 | 67 | if strings.Contains(msgStr, "C-3PO") { 68 | return proxylib.DROP, msgLen 69 | } 70 | 71 | return proxylib.PASS, msgLen 72 | } 73 | 74 | type factory struct{} 75 | 76 | func (f *factory) Create(connection *proxylib.Connection) proxylib.Parser { 77 | return &parser{connection: connection} 78 | } 79 | 80 | func init() { 81 | proxylib.RegisterParserFactory("r2d2", &factory{}) 82 | } 83 | ``` 84 | 85 | Finally, hook the new parser into the proxylib by importing the new parser package into the proxylib package. This will include the parser in the `libcilium.so` that is loaded by Envoy. Edit `proxylib/proxylib.go`: 86 | 87 | 最后,通过将新的parser包导入proxylib包,将新的解析器挂钩到proxylib。这将包括由Envoy加载的`libcilium.so` 中的parser。编辑 `proxylib/proxylib.go`: 88 | 89 | ```go 90 | import ( 91 | [...] 92 | _ "github.com/cilium/cilium/proxylib/r2d2" 93 | ) 94 | ``` 95 | 96 | 上面的示例省略了扩展的配置,集成到策略存储库以及访问日志记录的所有方面。有关如何编写Go扩展的分步指南,请参阅 [Envoy Go Extensions](https://cilium.readthedocs.io/en/v1.3/envoy/extensions/) 。 97 | 98 | ## Cilium Go Extension 协议识别 99 | 100 | > 备注:以下内容来自同事的分享,鸣谢! 101 | 102 | 以memcached extension为示例,CRD配置如下: 103 | 104 | ```yaml 105 | apiVersion: "cilium.io/v2" 106 | kind: CiliumNetworkPolicy 107 | description: "Secure the Rebel memcached service" 108 | metadata: 109 | name: "secure-rebel-alliance-memcache" 110 | specs: 111 | - endpointSelector: 112 | matchLabels: 113 | app: memcached 114 | ingress: 115 | - fromEndpoints: 116 | - matchLabels: 117 | function: fleet-maintanence 118 | toPorts: 119 | - ports: 120 | - port: "11211" 121 | protocol: TCP 122 | rules: 123 | l7proto: memcache 124 | l7: 125 | - command: "writeGroup" 126 | keyPrefix: "alliance/fleet/" 127 | - command: "get" 128 | keyPrefix: "alliance/fleet/" 129 | - fromEndpoints: 130 | - matchLabels: 131 | function: fleet-monitoring 132 | toPorts: 133 | - ports: 134 | - port: "11211" 135 | protocol: TCP 136 | rules: 137 | l7proto: memcache 138 | l7: 139 | - command: "get" 140 | keyPrefix: "alliance/fleet/" 141 | - fromEndpoints: 142 | - matchLabels: 143 | role: jedi 144 | toPorts: 145 | - ports: 146 | - port: "11211" 147 | protocol: TCP 148 | rules: 149 | l7proto: memcache 150 | l7: 151 | - command: 152 | ``` 153 | 154 | 配置的关键点在于ingress.fromEndpoints[],通过 matchLabels来选择endpoint,并指定port上的rule来标识指定endpoint上的特定端口的数据流需要通过哪个extension来处理。 155 | 156 | 协议规则下发流程如下: 157 | 158 | ![](images/ondata.png) 159 | 160 | 1. 通过cilium policy import xxx.json 导入新策略 161 | 2. proxylib 内部有个client 会去获取 policy rule,并通过 PolicyUpdate 生成 Policy Instance,增加rule 到PolicyMap。相关实现请查阅: 162 | 3. extension 中实现 Rule struct ,声明规则参数。如memcached rule: 163 | 164 | ``` 165 | // Rule matches against memcached requests 166 | type Rule struct { 167 | // allowed commands 168 | commands memcacheCommandSet 169 | // compiled regex 170 | keyExact []byte 171 | keyPrefix []byte 172 | regex *regexp.Regexp 173 | 174 | empty bool 175 | } 176 | ``` 177 | 178 | 4. extension 的OnData接口中,通过proxylib.connection.Matchs来匹配rule,然后实现特定的处理逻辑。 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /content/introduction/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 0 3 | --- 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /content/introduction/concept.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-09-18T21:07:13+08:00 3 | title: 概念 4 | weight: 102 5 | menu: 6 | main: 7 | parent: "introduction" 8 | keywords: 9 | - cilium组件 10 | - cilium部署模型 11 | - cilium术语 12 | - cilium概念 13 | description : "详细介绍Cilium组件,部署模型,术语和概念" 14 | --- 15 | 16 | 本文档的目标是描述Cilium架构的组件,以及在数据中心或云环境中部署Cilium的不同模型。 它侧重于运行完整的Cilium部署所需的更高级别的理解。然后,您可以使用更详细的安装指南来了解设置Cilium的详细信息。 17 | 18 | ## 组件概况 19 | 20 | ![](images/cilium-arch.png) 21 | 22 | Cilium的部署包括以下组件,运行在容器集群中的每个Linux容器节点上: 23 | 24 | - **Cilium Agent (Daemon):** 用户空间守护程序,通过插件与容器运行时和编排系统(如Kubernetes)交互,以便为在本地服务器上运行的容器设置网络和安全性。提供用于配置网络安全策略,提取网络可见性数据等的API。 25 | - **Cilium CLI Client:** 用于与本地Cilium Agent通信的简单CLI客户端,例如,用于配置网络安全性或可见性策略。 26 | - **Linux Kernel BPF:** 集成Linux内核的功能,用于接受内核中在各种钩子/跟踪点运行的已编译字节码。Cilium编译BPF程序,并让内核在网络堆栈的关键点运行它们,以便可以查看和控制进出所有容器中的所有网络流量。 27 | - **容器平台网络插件:** 每个容器平台(例如,Docker,Kubernetes)都有自己的插件模型,用于外部网络平台集成。对于Docker,每个Linux节点都运行一个进程(cilium-docker)来处理每个Docker libnetwork调用,并将数据/请求传递给主要的Cilium Agent。 28 | 29 | 除了在每个Linux容器主机上运行的组件之外,Cilium还利用键值存储在不同节点上运行的Cilium代理之间共享数据。目前支持的键值存储是: 30 | 31 | - etcd 32 | - consul 33 | 34 | 35 | ### Cilium Agent 36 | 37 | Cilium代理(cilium-agent)在每个Linux容器主机上运行。 在高级别,代理接受描述服务级别网络安全性和可见性策略的配置。然后,它会监听容器运行时中的事件,以了解容器何时启动或停止,并创建自定义BPF程序,Linux内核使用这些程序来控制进出这些容器的所有网络访问。更详细地说,代理: 38 | 39 | - 公开API以允许运维/安全团队配置安全策略(见下文)来控制集群中容器之间的所有通信。这些API还公开了监视功能,以进一步获取网络转发和过滤行为的可见性。 40 | - 收集有关每个被创建的新容器的元数据。特别是,它查询的身份元数据,如容器/pod标签,这些会用于标识Cilium安全策略中的Endpoint。 41 | - 与容器平台网络插件交互以执行IP地址管理(IPAM),IPAM控制为每个容器分配IPv4和IPv6地址。IPAM由代理管理,代理在所有插件之间的共享池中,这意味着Docker和CNI网络插件可以并行分配单个地址池。 42 | - 结合容器标识和地址的知识与已配置的安全性和可见性策略,生成高效的BPF程序,这些程序适用于每个容器的网络转发和安全行为。 43 | - 使用[clang/LLVM](https://clang.llvm.org/)将BPF程序编译为字节码,并将它们传递给Linux内核,以便为进出容器虚拟以太网设备中的所有数据包而运行 44 | 45 | ### Cilium CLI Client 46 | 47 | Cilium CLI Client(cilium)是一个与Cilium Agent一起安装的命令行工具。它提供了一个命令行界面,可与Cilium Agent API的所有方面进行交互。包括检查有关每个网络端点(如容器)的Cilium状态,配置和查看安全策略以及配置网络监视行为。 48 | 49 | ### Linux Kernel BPF 50 | 51 | Berkeley Packet Filter (BPF)是最初用于过滤网络数据包的Linux内核字节码解释器,例如, tcpdump和套接字过滤器。它已经扩展了其他数据结构,如hashtable和数组,以及支持数据包修改,转发,封装等的其他操作。内核验证程序确保BPF程序可以安全运行,然后JIT编译器转换字节码到CPU体系结构特定指令,以求原生执行效率。BPF程序可以在内核中的各个钩子点运行,例如传入数据包,传出数据包,系统调用,kprobes等。 52 | 53 | 每个新的Linux版本,BPF都在不断发展并获得更多功能。Cilium利用BPF执行核心数据路径过滤,修改,监控和重定向,并且需要Linux内核版本4.8.0或更高版本的BPF功能。在4.8.x已被宣布为生命周期结束且4.9.x被提名为稳定版本的基础上,我们建议至少运行内核4.9.17(截至本文撰写时,最新的当前稳定Linux内核为4.10.x)。 54 | 55 | Cilium能够探测Linux内核的可用功能,并在检测到它们时自动使用更新的功能。 56 | 57 | 专注于成为容器运行时的Linux发行版(例如,CoreOS,Fedora Atomic)通常已经发布了比4.8更新的内核,但即使是最新版本的通用操作系统(如Ubuntu 16.10)也提供了相当新的内核。一些Linux发行版仍然发布较旧的内核,但其中许多允许从单独的内核包仓库中安装最新的内核。 58 | 59 | ### Key-Value Store 60 | 61 | 键值(KV)存储用于以下状态: 62 | 63 | - 策略标识:标签列表<=>策略标识标识符 64 | - 全局服务:VIP协会的全局服务ID(可选) 65 | - 封装VTEP映射(可选) 66 | 67 | 为了简化更大部署中的内容,可以与容器编排器使用相同的键值存储(例如,Kubernetes使用etcd)。 68 | 69 | ### 保证 70 | 71 | 如果Cilium失去与KV-Store的连接,它可以保证: 72 | 73 | - 正常的网络操作将继续; 74 | - 如果启用了策略实施,现有端点仍将强制执行其策略,但您将无法添加其他容器,这些容器属于安全身份,但是在节点上无法获知; 75 | - 如果启用了服务,您将无法添加其他服务/负载均衡器; 76 | - 当连接恢复到KV-Store时,Cilium最多可能需要5分钟才能与KV-Store重新同步不同步的状态。 77 | 78 | 即使与KV-Store不同步,Cilium也会继续运行。 79 | 80 | 如果Cilium崩溃/或DaemonSet被意外删除,则有以下保证: 81 | 82 | - 当使用标准安装指南文档中提供的规范文件运行Cilium作为DaemonSet/容器时,已运行的端点/容器不会损失任何连接,并且它们将使用在Cilium意外停止之前加载的策略继续运行。 83 | - 以不同的方式运行Cilium时,只需确保bpf fs被装载 [Mounting the BPF FS](https://cilium.readthedocs.io/en/v1.2/kubernetes/install/standard/#admin-mount-bpffs)。 84 | 85 | ## 术语 86 | 87 | ### Labels 88 | 89 | 标签是一种通用,灵活且高度可扩展的方式,用于处理大量资源,因为它们允许任意分组和创建集合。 每当需要描述,寻址或选择某些内容时,都会根据标签完成: 90 | 91 | - [Endpoint](#endpoints) 在被从容器运行时,编排系统,或者其他源派生时分配标签。 92 | - [Network Policy](#network-policies) 选择 [Endpoint](#endpoints) 对,这些端点对被容许基于标签相互通讯。策略本身也由标签标示。 93 | 94 | #### Label是什么? 95 | 96 | A label is a pair of strings consisting of a `key` and `value`. A label can be formatted as a single string with the format `key=value`. The key portion is mandatory and must be unique. This is typically achieved by using the reverse domain name notion, e.g. `io.cilium.mykey=myvalue`. The value portion is optional and can be omitted, e.g. `io.cilium.mykey`. 97 | 98 | 标签是一对由`key`和`value`组成的字符串。 标签可以格式化为单个字符串,格式为`key=value`。 key部分是强制性的,必须是唯一的。通常通过使用反向域名概念来实现,例如,`io.cilium.mykey=myvalue`。 value部分是可选的,可以省略,例如,`io.cilium.mykey`。 99 | 100 | key名通常应由字符集`[a-z0-9-.]`组成。 101 | 102 | 使用标签选择资源时,key和value必须匹配,例如当策略应该应用于标签为`my.corp.foo`的所有端点时,标签`my.corp.foo=bar`将与选择器不匹配。 103 | 104 | #### Label Source 105 | 106 | 标签可以来自各种来源。 例如,端点将由本地容器运行时派生与容器关联的标签,以及Kubernetes提供的与pod关联的标签。 由于这两个标签命名空间彼此不了解,这可能导致标签key冲突。 107 | 108 | To resolve this potential conflict, Cilium prefixes all label keys with `source:` to indicate the source of the label when importing labels, e.g. `k8s:role=frontend`, `container:user=joe`, `k8s:role=backend`. This means that when you run a Docker container using `docker run [...] -l foo=bar`, the label `container:foo=bar` will appear on the Cilium endpoint representing the container. Similarly, a Kubernetes pod started with the label `foo: bar` will be represented with a Cilium endpoint associated with the label `k8s:foo=bar`. A unique name is allocated for each potential source. The following label sources are currently supported: 109 | 110 | 为了解决这种潜在的冲突,Cilium在所有标签key前加上`source:` 以指示导入标签时标签的来源,例如: `k8s:role=frontend`,`container:user=joe`,`k8s:role=backend`。 这意味着当您使用`docker run [...] -l foo=bar`运行Docker容器时,标签`container:foo=bar`将出现在表示容器的Cilium端点上。 类似地,以标签 `foo: bar`开始的Kubernetes pod将用与标签`k8s:foo=bar`相关联的Cilium端点表示。 为每个潜在来源分配唯一名称。 目前支持以下标签来源: 111 | 112 | - `container:` 用于从本地容器运行时派生的标签 113 | - `k8s:` 来自Kubernetes的标签 114 | - `mesos:` 用于从Mesos派生的标签 115 | - `reserved:` 有关特殊保留标签,请参阅 [Special Identities](#reserved-labels). 116 | - `unspec:` 用于具有未指定源的标签 117 | 118 | 使用标签标识其他资源时,可以包含源以限制标签与特定类型的匹配。 如果未提供源,则标签源默认为`any:`将匹配所有标签,无论其来源如何。 如果提供了源,则选择和匹配标签的来源需要匹配。 119 | 120 | ### Endpoint 121 | 122 | Cilium通过分配IP地址使应用程序容器在网络上可用。多个应用程序容器可以共享相同的IP地址; 这个模型的一个典型例子是Kubernetes [`Pod`](#term-pod)。 共享公共地址的所有应用程序容器在Cilium所指的端点中组合在一起。 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | TBD 137 | 138 | > 备注:以上内容来自cilium官方文档 [Concepts](https://cilium.readthedocs.io/en/v1.2/concepts/) -------------------------------------------------------------------------------- /content/introduction/images/cilium-arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/content/introduction/images/cilium-arch.png -------------------------------------------------------------------------------- /content/introduction/images/cilium-connectivity.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/content/introduction/images/cilium-connectivity.jpg -------------------------------------------------------------------------------- /content/introduction/images/cilium-ecosystem.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/content/introduction/images/cilium-ecosystem.jpg -------------------------------------------------------------------------------- /content/introduction/images/cilium-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | image/svg+xml -------------------------------------------------------------------------------- /content/introduction/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-08-09T21:07:13+08:00 3 | title: 介绍 4 | weight: 100 5 | keywords: 6 | - cilium 7 | - cilium介绍 8 | - cilium的功能 9 | description : "Cilium的介绍和功能概述" 10 | --- 11 | 12 | ![](images/cilium-logo.svg) 13 | 14 | ## Cilium是什么? 15 | 16 | Cilium是一个开源软件,用于透明地提供和保护使用Kubernetes,Docker和Mesos等Linux容器管理平台部署的应用程序服务之间的网络和API连接。 17 | 18 | ![](images/cilium-connectivity.jpg) 19 | 20 | Cilium基于一种名为BPF的新Linux内核技术,它可以在Linux内部动态插入强大的安全性,可见性和网络控制逻辑。 除了提供传统的网络级安全性之外,BPF的灵活性还可以在API和进程级别上实现安全性,以保护容器或容器内的通信。由于BPF在Linux内核中运行,因此可以应用和更新Cilium安全策略,而无需对应用程序代码或容器配置进行任何更改。 21 | 22 | ![](images/cilium-ecosystem.jpg) 23 | 24 | ## 为什么用Cilium? 25 | 26 | 现代数据中心应用程序的开发已经转向面向服务的体系结构,通常称为**微服务**,其中大型应用程序被分成小型独立服务,这些服务使用HTTP等轻量级协议通过API相互通信。微服务应用程序往往是高度动态的,使用单个容器,随着应用程序扩展/收缩而启动或销毁,以适应负载变化,以及滚动更新,作为持续交付的一部分而部署。 27 | 28 | 这种向高度动态微服务的转变在保护微服务之间的连接方面提出了挑战和机遇。传统的Linux网络安全方法(例如,iptables)过滤IP地址和TCP/UDP端口,但IP地址在动态微服务环境中经常流失。容器高度不稳定的生命周期导致这些方法难以与应用程序并排扩展,因为负载平衡表和访问控制列表包含需要以不断增长的频率更新的数十万条规则。出于安全目的,协议端口(例如,用于HTTP流量的TCP端口80)不再能够用于区分应用流量,因为端口用于跨服务的各种消息。 29 | 30 | 另一个挑战是提供准确可见性的能力,因为传统系统使用IP地址作为主要识别工具,在微服务架构中可能大大缩短,仅仅几秒钟的寿命。 31 | 32 | 通过利用Linux BPF,Cilium保留了透明地插入安全可视性+强制执行的能力,但这种方式基于service/pod/container标识(与传统系统中的IP地址识别相反),并且可以在应用层(例如HTTP)进行过滤。因此,通过将安全性与寻址分离,Cilium不仅可以在高度动态的环境中应用安全策略,而且除了提供传统的第3层和第4层分割之外,还可以通过在HTTP层操作来提供更强的安全隔离。。 33 | 34 | BPF的使用使Cilium能够以高度可扩展的方式实现所有这一切,即使对于大规模环境也是如此。 35 | 36 | ## 功能概述 37 | 38 | ### 透明地保护和加密API 39 | 40 | 能够保护现代应用程序协议,如REST/HTTP,gRPC和Kafka。传统防火墙在第3层和第4层运行。在特定端口上运行的协议要么完全受信任,要么完全被阻止。Cilium提供了过滤各个应用程序协议请求的功能,例如: 41 | 42 | - 允许所有使用方法`GET`和路径`/public/.*`的HTTP请求。拒绝所有其他请求。 43 | - 允许`service1`在Kafka主题`topic1`生成和`service2`在`topic1`上消费。拒绝所有其他Kafka消息。 44 | - 要求HTTP标头`X-Token:[0-9] +`出现在所有REST调用中。 45 | 46 | ### 基于身份的服务间安全通信 47 | 48 | 现代分布式应用程序依赖于诸如应用程序容器之类的技术来促进部署中的敏捷和按需扩展。这导致在短时间内启动大量应用容器。典型的容器防火墙通过过滤源IP地址和目标端口来保护工作负载。这个概念要求在集群中的任何位置启动容器时都要操作所有服务器上的防火墙。 49 | 50 | 为了避免这种限制扩展的情况,Cilium为共享相同安全策略的应用程序容器组分配安全标识。然后,该标识与应用程序容器发出的所有网络数据包相关联,从而允许在接收节点处验证身份。使用键值存储执行安全身份管理。 51 | 52 | ### 安全访问外部服务 53 | 54 | 基于标签的安全性是集群内部访问控制的首选工具。为了保护对外部服务的访问,支持传统基于CIDR的入口和出口的安全策略。这允许将对应用程序容器的访问限制在特定IP范围内。 55 | 56 | ### 简单网络 57 | 58 | 一个简单的扁平3层网络能够跨越多个集群连接所有应用程序容器。使用主机范围分配器可以简化IP分配。这意味着每个主机可以在主机之间没有任何协调的情况下分配IP。 59 | 60 | 支持以下多节点网络模型: 61 | 62 | - **Overlay:** 基于封装的虚拟网络,产生所有主机。目前VXLAN和Geneve已经完成,但可以启用Linux支持的所有封装格式。 63 | 64 | 何时使用此模式:此模式具有最小的基础设施和集成要求。它几乎适用于任何网络基础设施,因为唯一的要求是主机之间的IP连接,这通常已经给出。 65 | 66 | - **Native Routing:** 使用Linux主机的常规路由表。网络必须能够路由应用程序容器的IP地址。 67 | 68 | 何时使用此模式:此模式适用于高级用户,需要了解底层网络基础结构。此模式适用于: 69 | 70 | - 原生 IPv6 网络 71 | - 与云网络路由器配合使用 72 | - 如果您已经在运行路由守护进程 73 | 74 | ### 负载均衡 75 | 76 | 应用程序容器之间和到外部服务的流量分布式负载均衡。负载均衡使用BPF,使用高效hashtables,允许几乎无限制的规模,并且如果未在源主机上执行负载均衡操作,则支持直接服务器返回(DSR)。 77 | 78 | ### 监控和故障排除 79 | 80 | 获得可见性和解决问题的能力是任何分布式系统运维的基础。虽然我们学会了诸如tcpdump和ping这样的工具,虽然他们总会在我们心中找到一个特殊的地方,但我们会努力为故障排除提供更好的工具。这包括提供以下工具: 81 | 82 | - 使用元数据进行事件监视:当丢弃数据包时,该工具不仅报告数据包的源IP和目标IP,该工具还提供发送方和接收方的完整标签信息以及许多其他信息。 83 | - 策略决策跟踪:为什么丢弃数据包或拒绝请求。策略跟踪框架允许跟踪策略决策过程,包括运行中的工作负载和基于任意标签的定义。 84 | - 通过Prometheus导出指标:通过Prometheus导出关键指标,以便与现有仪表板集成。 85 | 86 | ### 集成 87 | 88 | - 网络插件集成: [CNI](https://github.com/containernetworking/cni), [libnetwork](https://github.com/docker/libnetwork) 89 | - 容器运行时事件: [containerd](https://github.com/containerd/containerd) 90 | - Kubernetes: [NetworkPolicy](https://kubernetes.io/docs/concepts/services-networking/network-policies/), [Labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/), [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/), [Service](https://kubernetes.io/docs/concepts/services-networking/service/) 91 | - 日志: syslog, [fluentd](http://www.fluentd.org/) 92 | 93 | > 备注: 以上内容翻译自cilium官方文档 [Introduction to Cilium](https://cilium.readthedocs.io/en/v1.2/intro/#intro) -------------------------------------------------------------------------------- /content/introduction/information.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-09-09T21:07:13+08:00 3 | title: 信息收集 4 | weight: 110 5 | menu: 6 | main: 7 | parent: "introduction" 8 | keywords: 9 | - cilium资料 10 | - cilium官方资料 11 | - cilium社区资料 12 | - cilium学习资料 13 | description : "收集Cilium的各种资料" 14 | --- 15 | 16 | ## 官方资料 17 | 18 | - [官方网站](https://cilium.io/) 19 | - [cilium@github](https://github.com/cilium/cilium) 20 | - [官方博客](https://cilium.io/blog/) 21 | - [官方文档](https://cilium.readthedocs.io/): 目前是1.2版本 22 | 23 | ## 社区资料 24 | 25 | - [InfoQ中国站上cilium的搜索结果](http://www.infoq.com/cn/search.action?queryString=cilium&page=1&searchOrder=) 26 | - [InfoQ国际站上cilium的搜索结果](https://www.infoq.com/search.action?queryString=cilium&page=1&searchOrder=) 27 | - [servicemesher社区网站上cilium的文章](http://www.servicemesher.com/tags/cilium) 28 | 29 | ## 学习资料 30 | 31 | ### 博客文章 32 | 33 | - [官方博客](https://cilium.io/blog/): 有大量博客文章推荐阅读 34 | - [Cilium 1.2: DNS Security Policies, EKS Support, ClusterMesh, kube-router integration, ...](https://cilium.io/blog/2018/08/21/cilium-12):2018-08-21,官方博客文章,中文翻译版本请见 [Cilium 1.2发布—DNS安全性策略、EKS支持、ClusterMesh、kube-router集成等](http://www.servicemesher.com/blog/cilium1.2-dns-security-policies-eks-support-clustermesh-kube-router-integration/) 35 | - [Istio 1.0: How Cilium enhances Istio with socket-aware BPF programs](https://cilium.io/blog/2018/08/07/istio-10-cilium/): 2018-08-07,官方博客文章,中文翻译版本请见 [使用Cilium增强Istio—通过Socket感知BPF程序](http://www.servicemesher.com/blog/how-cilium-enhances-istio-with-socket-aware-bpf-programs/) 36 | - [Cilium: Making BPF Easy on Kubernetes for Improved Security, Performance](https://thenewstack.io/cilium-making-bpf-easy-on-kubernetes-for-improved-security-performance/): 2018-07-23 37 | - [Cilium 1.0.0-rc4 Released: Transparently Secure Container Network Connectivity Utilising Linux BPF](https://www.infoq.com/news/2018/03/cilium-linux-bpf)](https://www.infoq.com/news/2018/03/cilium-linux-bpf) : 2018-03-04,中文翻译版本请见 [Cilium 1.0.0-rc4发布:使用Linux BPF实现透明安全的容器间网络连接](http://www.infoq.com/cn/news/2018/03/cilium-linux-bpf) 38 | - [Cilium: Networking and security for containers with BPF and XDP](https://opensource.googleblog.com/2016/11/cilium-networking-and-security.html): 2016-11-02 39 | 40 | ### 演讲视频 41 | 42 | - [How to Make Linux Microservice-Aware with Cilium and eBPF](https://www.infoq.com/presentations/linux-cilium-ebpf): 2019-04, 有中文翻译版本,[如何基于 Cilium 和 eBPF 打造可感知微服务的 Linux?](http://dockone.io/article/8789) 43 | - [TGI Kubernetes 047: Cilium (CNI)](https://www.youtube.com/watch?v=I8Tp7jU2oJk): 2018-08-17 44 | - [Cilium-Accelerating Envoy and Istio with Cilium and Linux Kernel](https://www.youtube.com/watch?v=ER9eIXL2_14): 2018-05-06 45 | - [Cilium + gRPC Intro - Microservices-aware Network Security](https://www.youtube.com/watch?v=-aUHGeBRDPU): 2017-12-07 46 | - [Cilium Kafka Demo](https://www.youtube.com/watch?v=zK5hy6nsYEg): 2017-11-29 47 | - [Cilium - Container Security and Networking Using BPF and XDP - Thomas Graf, Covalent](https://www.youtube.com/watch?v=CcGtDMm1SJA): 2017-09-15 48 | - [Cilium: Network and Application Security with BPF and XDP](https://www.youtube.com/watch?v=ilKlmTDdFgk): 2017-04-26 49 | - [Cilium - BPF & XDP for containers](https://www.youtube.com/watch?v=TnJF7ht3ZYc): 2016-10-14 50 | 51 | -------------------------------------------------------------------------------- /content/introduction/releases.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: 2018-09-18T21:07:13+08:00 3 | title: 已发布版本 4 | weight: 112 5 | menu: 6 | main: 7 | parent: "introduction" 8 | keywords: 9 | - cilium版本信息 10 | - cilium最新版本 11 | - cilium release note 12 | description : "收集Cilium各个发布版本的信息和Release Note" 13 | --- 14 | 15 | ## v1.3 16 | 17 | 发布于2018-10-23。 18 | 19 | 官方博客文章: 20 | 21 | - [Cilium 1.3: Go extensions for Envoy, Cassandra & Memcached Support](https://cilium.io/blog/2018/10/23/cilium-13-envoy-go/) 22 | 23 | 1.3 Release Highlights: 24 | 25 | - **Go extensions for Envoy** 26 | - Exciting new extension API for Envoy using Go including a generic configuration and access logging API. (Beta) 27 | - **Cassandra & Memcached protocol support** 28 | - New protocol parsers for Cassandra and Memcached implemented using the new Envoy Go extensions. Both parsers provide visibility and security policy enforcement on operation type and key/table names using exact matches, prefix matches, and regular expressions. (Beta) 29 | - **Security** 30 | - TTLs support for DNS/FQDN policy rules 31 | - Introduction of well-known identities for kube-dns, coredns, and etcd-operator. 32 | - New security identity "unmanaged" to represent pods which are not managed by Cilium. 33 | - Improved security entity "cluster" which allows defining policies for all pods in a cluster (managed, unmanaged and host networking). 34 | - **Additional Metrics & Monitoring** 35 | - New "cilium metrics list" command to list metrics via CLI. 36 | - Lots of additional metrics: connection tracking garbage collection, Kubernetes resource events, IPAM, endpoint regenerations, services, and error and warning counters. 37 | - New monitoring API with more efficient encoding/decoding protocol. Used by default with fallback for older clients. 38 | - **Networking Improvements** 39 | - Split of connection tracking tables into TCP and non-TCP to better handle the mix of long and short-lived nature of each protocol. 40 | - Ability to specify the size of the connection tracking tables via ConfigMap. 41 | - Better masquerading behavior for traffic via NodePort and HostPort to allow pods to see the original source IP if possible. 42 | - **Full Key-value store Resiliency** 43 | - Introduced ability to re-construct the kvstore contents immediately after loss of any state. Allows to restore etcd from backup or to completely wipe it for a running cluster with minimal impact. (Beta) 44 | - **Efficiency & Scale** 45 | - Significant improvements in the cost of calculating policy of individual endpoints. Work continues on this subject. 46 | - New grace period when workloads change identity to minimize connectivity impact throughout identity change. 47 | - More efficient security identity allocation algorithm. 48 | - New generic framework to detect and ignore Kubernetes event notifications for which Cilium does not need to take action. 49 | - Improvements in avoiding unnecessary BPF compilations to reduce the CPU overhead caused by it. Initial work to scope BPF templating to avoid compilation altogether. 50 | - **Kubernetes** 51 | - Added support for Kubernetes 1.12 52 | - Custom columns for the CiliumEndpoints CRD (Requires Kubernetes 1.11) 53 | - Removed cgo dependency from cilium-cni for compatibility with ulibc 54 | - Removed support for Kubernetes 1.7 55 | - **Documentation** 56 | - New Ubuntu 18.04 guide 57 | - Coverage of latest BPF runtime features such as BTF (BPF Type Format). 58 | - Documentation for VM/host firewall requirements to run multi-host networking. 59 | - **Long Term Stable (LTS) Release** 60 | - 1.3 has been declared an LTS release and will be supported for the next 6 months with backports. 61 | 62 | ## v1.2 63 | 64 | 发布于2018-09-21。 65 | 66 | 官方博客文章和中文翻译: 67 | 68 | - [Cilium 1.2: DNS Security Policies, EKS Support, ClusterMesh, kube-router integration, ...](https://cilium.io/blog/2018/08/21/cilium-12) 69 | - [Cilium 1.2发布—DNS安全性策略、EKS支持、ClusterMesh、kube-router集成等](http://www.servicemesher.com/blog/cilium1.2-dns-security-policies-eks-support-clustermesh-kube-router-integration/) 70 | 71 | 该版本引入了几个新功能实现了Cilium用户和社区成员最迫切想要的功能。 72 | 73 | 1. 其中最吸引人的功能之一是引入基于DNS 名称的安全策略,目的是保护对集群外服务的访问。 74 | 2. 另一个最受关注的问题是加入了连接和保护多个Kubernetes集群的能力。 75 | - 我们将ClusterMesh功能进入Alpha版本。它可以连接和保护在多个Kubernetes集群中运行的pod。 76 | - Kube-router与Cilium的集成同等重要。DigitalOcean团队的努力使kube-router提供BGP网络与Cilium提供的基于BPF的安全性和负载均衡相结合。 77 | 78 | 1.2版本的重要功能: 79 | 80 | - 基于DNS/FQDN的安全策略 81 | - 基于FQDN/DNS命名定义网络安全规则,表示允许连接到外部服务。例如,允许访问foo.com。(处于Beta版) 82 | - 支持AWS EKS 83 | - 为管理Kubernetes集成量身定制的etcd operator,消除了对需要外部kvstore的依赖。(处于Beta版) 84 | - Clustermesh(集群间连接) 85 | - 跨多个Kubernetes集群的pod间网络连接。(处于Alpha版) 86 | - 跨集群的基于label的网络安全策略实施,例如允许cluster1中的pod foo与cluster2中的pod bar通信。 87 | - 为支持BPF集成Kube-route 88 | - 与kube-router一起协作运行以启用BGP网络。 89 | - 基于节点发现的KV存储 90 | - 在非Kubernetes环境中启用自动节点发现。 91 | - 负载均衡 92 | - 支持一致的后端selection用于服务后端扩缩容 93 | - 支持基于服务label/name的策略以及L4规则 94 | - 高效性 & 扩缩容 95 | - 对于大型和多集群规模的环境,安全身份认证空间从16bits增加到24bits。 96 | - 首次实现基于BPF的数据路径通知聚合。 97 | - 取得持续高效的CPU利用进展。 98 | - 自动检测underlying网络的MTU。 99 | - 禁用DSR时使用本地service ID分配以提高负载均衡可伸缩性。 100 | - 文档 101 | - 新的AWS EKS安装指南。 102 | - 参考kubespray安装指南。 103 | - 新的简化安装和升级说明。 -------------------------------------------------------------------------------- /static/google5713250934492ab9.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google5713250934492ab9.html -------------------------------------------------------------------------------- /static/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/static/images/favicon.ico -------------------------------------------------------------------------------- /static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyao/learning-cilium/32fb0ad8c14149df0f8d516b8578a195e9af29dd/static/images/logo.png --------------------------------------------------------------------------------