图书目录

目  录

 

第1章  云原生与容器运行时 1

1.1 云原生概述 1

1.1.1  云原生的定义 1

1.1.2  云原生应用的价值 3

1.1.3  云原生应用与传统应用对比 3

1.2  云原生技术栈与容器运行时 4

1.2.1  云原生技术栈 4

1.2.2  容器运行时 5

1.3  Docker与Kubernetes的发展史 7

1.3.1  Docker的发展历史及与容器世界的关联 7

1.3.2  Docker架构的发展 13

1.4  containerd概述 15

第2章  初识容器运行时 18

2.1  容器技术的发展史 19

2.2  容器Linux基础 25

2.2.1  容器是如何运行的 25

2.2.2  namespace 27

2.2.3  Cgroups 46

2.2.4  chroot和pivot_root 52

2.3  容器运行时概述 54

2.3.1  什么是容器运行时 54

2.3.2  OCI规范 55

2.3.3  低级容器运行时 70

2.3.4  高级容器运行时 71

第3章  使用containerd 73

3.1 containerd的安装与部署 74

3.1.1  containerd的安装 74

3.1.2  配置containerd.service 76

3.2 ctr的使用 78

3.2.1  ctr的安装 78

3.2.2  namespace 80

3.2.3  镜像操作 82

3.2.4  容器操作 85

3.3 nerdctl的使用 89

3.3.1  nerdctl的设计初衷 89

3.3.2  安装和部署nerdctl 90

3.3.3  nerdctl的命令行使用 92

3.3.4  运行容器 95

3.3.5  构建镜像 96

第4章  containerd与云原生生态 99

4.1 Kubernetes与CRI 99

4.1.1  Kubernetes概述 99

4.1.2  CRI与containerd在Kubernetes生态中的演进 101

4.1.3  CRI概述 104

4.1.4  几种CRI实现及其概述 110

4.2  containerd与CRI Plugin 115

4.2.1  containerd中的CRI Plugin 115

4.2.2  CRI Plugin中的重要配置 117

4.2.3  CRI Plugin中的配置项全解 130

4.3  crictl的使用 138

4.3.1  crictl概述 138

4.3.2  crictl的安装和配置 139

4.3.3  crictl使用说明 142

第5章  containerd与容器网络 153

5.1  容器网络接口 153

5.1.1  CNI概述 153

5.1.2  CNI配置文件的格式 155

5.1.3  容器运行时对CNI插件的调用 157

5.1.4  CNI插件的执行流程 160

5.1.5  CNI插件的委托调用 166

5.1.6  CNI插件接口的输出格式 167

5.1.7  手动配置容器网络 169

5.2  CNI插件介绍 181

5.2.1  main类插件 182

5.2.2  ipam类插件 197

5.2.3  meta类插件 203

5.3  containerd中CNI的使用 209

5.3.1  containerd中CNI的安装与部署 209

5.3.2  nerdctl使用CNI 210

5.3.3  CRI使用CNI 214

5.3.4  ctr使用CNI 215

第6章  containerd与容器存储 216

6.1 containerd中的数据存储 216

6.1.1  理解容器镜像 216

6.1.2  containerd中的存储目录 219

6.1.3  containerd中的镜像存储 222

6.1.4  containerd中的content 223

6.1.5  containerd中的snapshot 230

6.2  containerd镜像存储插件

snapshotter 234

6.2.1  Docker中的镜像存储管理

graphdriver 235

6.2.2  graphdriver与snapshotter 237

6.2.3  snapshotter概述 238

6.2.4  containerd中如何使用snapshotter 243

6.3  containerd支持的snapshotter 246

6.3.1  native snapshotter 246

6.3.2  overlayfs snapshotter 250

6.3.3  devmapper snapshotter 258

第7章  containerd核心组件解析 272

7.1 containerd架构总览 272

7.2  containerd API和Core 274

7.2.1  GRPC API 275

7.2.2  Services 289

7.2.3  Metadata 290

7.3  containerd Backend 293

7.3.1  containerd中的proxy plugins 294

7.3.2  containerd中的Runtime和shim 297

7.3.3  containerd shim规范 300

7.3.4  shim工作流程解析 306

7.4  containerd与NRI 309

7.4.1  NRI概述 310

7.4.2  NRI插件原理 311

7.4.3  containerd中启用NRI插件 319

7.4.4  containerd NRI插件示例 320

7.4.5  NRI插件的应用 322

第8章  containerd生产与实践 323

8.1  containerd监控实践 323

8.1.1  安装Prometheus 323

8.1.2 Prometheus上containerd的指标

采集配置 326

8.1.3  Grafana监控配置 330

8.1.4  配置containerd面板 330

8.2  基于containerd开发自己的

容器客户端 332

8.2.1  初始化Client 333

8.2.2  拉取镜像 334

8.2.3  创建OCI Spec 334

8.2.4  创建task 334

8.2.5  启动task 335

8.2.6  停止task 335

8.2.7  运行示例 336

8.3  开发自己的NRI插件 337

8.3.1  插件定义与接口实现 337

8.3.2  插件实例化与启动 339

8.3.3  插件的运行演示 339