教程结构调整
@ -179,26 +179,38 @@ module.exports = {
|
||||
collapsable: false,
|
||||
children: [
|
||||
'k8s-intermediate/ingress',
|
||||
'k8s-intermediate/private-registry',
|
||||
{
|
||||
title: '工作负载',
|
||||
collapsable: false,
|
||||
collapsable: true,
|
||||
children: [
|
||||
'k8s-intermediate/workload/pod',
|
||||
'k8s-intermediate/workload/pod-lifecycle',
|
||||
'k8s-intermediate/workload/init-container',
|
||||
'k8s-intermediate/workload/workload',
|
||||
'k8s-intermediate/workload/wl-deployment',
|
||||
'k8s-intermediate/workload/wl-statefulset',
|
||||
'k8s-intermediate/workload/wl-daemonset',
|
||||
'k8s-intermediate/workload/wl-job',
|
||||
'k8s-intermediate/workload/wl-cronjob',
|
||||
]
|
||||
},
|
||||
'k8s-intermediate/config-map',
|
||||
'k8s-intermediate/private-registry',
|
||||
{
|
||||
title: '持久化数据',
|
||||
collapsable: false,
|
||||
title: '存储',
|
||||
collapsable: true,
|
||||
children: [
|
||||
'k8s-intermediate/persistent/volume',
|
||||
'k8s-intermediate/persistent/pv',
|
||||
'k8s-intermediate/persistent/storage-class',
|
||||
// 'k8s-intermediate/persistent/nfs',
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '配置',
|
||||
collapsable: true,
|
||||
children: [
|
||||
'k8s-intermediate/config/config-map',
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -6,6 +6,11 @@ p img {
|
||||
max-width: calc(70vw - 40px);
|
||||
}
|
||||
|
||||
.sidebar-group.is-sub-group > .sidebar-heading:not(.clickable) {
|
||||
font-size: 1em !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-moz-user-select: -moz-none;
|
||||
-moz-user-select: none;
|
||||
|
||||
83
.vuepress/theme/layouts/LearningLayout.vue
Normal file
@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<ParentLayout>
|
||||
<div slot="sidebar-top">
|
||||
<div style="text-align: center; margin-top: 20px;">
|
||||
<div class="side-nav-item" :style="activeLinkStyle('/overview/') + 'margin-left: 0;'">
|
||||
<a href="/overview/" class="nav-link">简介</a>
|
||||
</div>
|
||||
<div class="side-nav-item" :style="activeLinkStyle('/install/')">
|
||||
<a href="/install/install-dashboard.html" class="nav-link router-link-exact-active router-link-active">安装</a>
|
||||
</div>
|
||||
<div class="side-nav-item" :style="activeLinkStyle('/learning/')">
|
||||
<a href="/learning/" class="nav-link router-link-exact-active router-link-active">学习</a>
|
||||
</div>
|
||||
<div class="side-nav-item" :style="activeLinkStyle('/guide/')">
|
||||
<a href="/guide/" class="nav-link">使用</a>
|
||||
</div>
|
||||
<div class="side-nav-item" :style="activeLinkStyle('/micro-service/')">
|
||||
<a href="/micro-service/overview/kuboard-view-of-k8s.html" class="nav-link">微服务</a>
|
||||
</div>
|
||||
<!-- <div class="side-nav-item" :style="activeLinkStyle('/noactive/')">
|
||||
<a href="https://blog.kuboard.cn/compaign/" target="_blank" class="nav-link">博客</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<StarGazer/>
|
||||
<Promotion/>
|
||||
</div>
|
||||
<div slot="page-top" class="page-top">
|
||||
<div style="display: inline-block; width: 400px;">
|
||||
<li><span style="color: red; font-weight: 500;">免费</span> Kubernetes 教程,绝对不降低品质</li>
|
||||
<li>QQ 群 <span style="color: red; font-weight: 500;">在线答疑</span>,加群请扫描侧边栏下方的二维码</li>
|
||||
<li>根据 QQ 群答疑情况,<span style="color: red; font-weight: 500;">不断完善</span> 教程</li>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="page-bottom" class="bottom-description">Copyright © 2019-present 邵欢庆 <a href="http://www.eigpay.com" target="_blank">仁聚汇通</a> | 京ICP备19008693号-2</div>
|
||||
</ParentLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ParentLayout from '@parent-theme/layouts/Layout.vue'
|
||||
|
||||
export default {
|
||||
mounted () {
|
||||
},
|
||||
components: {
|
||||
ParentLayout
|
||||
},
|
||||
methods: {
|
||||
activeLinkStyle(href) {
|
||||
if (this.$page.path.indexOf(href) === 0) {
|
||||
return 'border-bottom: 2px solid #0b85ff;'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-top {
|
||||
margin-top: 5em;
|
||||
margin-bottom: -50px;
|
||||
padding: 0 40px;
|
||||
}
|
||||
.bottom-description {
|
||||
text-align: center;
|
||||
font-size: 0.8rem;
|
||||
color: #909399;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
.side-nav-item {
|
||||
margin-bottom: -2px;
|
||||
margin-left: 10px;
|
||||
display: inline-block;
|
||||
line-height: 1.4rem;
|
||||
white-space: nowrap;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.side-nav-item a {
|
||||
color: #2c3e50;
|
||||
}
|
||||
</style>
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: Kubernetes 学习路径推荐
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文详细讲解了 Kubernetes Deployment 的概念,并描述了如何使用 kubectl / Kuboard 创建一个 Deployment
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍了如何使用 kubectl / Kuboard 查看和浏览 Kubernetes 上的节点、容器组、部署等信息,并依据这些信息作出问题诊断。
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文详细讲解了 Kubernetes Service 的概念,并描述了如何使用 kubectl / Kuboard 创建一个 Service,以使得部署在 Kubernetes 上的容器可以被访问。
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 以 gif 动图的形式形象的描述 Kubernetes 核心概念。本文将会简单介绍Kubernetes的核心概念。因为这些定义可以在Kubernetes的文档中找到,所以文章也会避免用大段的枯燥的文字介绍。相反,我们会使用一些图表(其中一些是动画)和示例来解释这些概念。我们发现一些概念(比如Service)如果没有图表的辅助就很难全面地理解。在合适的地方我们也会提供Kubernetes文档的链接以便读者深入学习。
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文为初学者介绍了一套最合适的 Kubernetes 入门教程,该教程源自于 Kubernetes 官方网站,作者对其进行了翻译,并根据初学者的理解情况做了适当的改写。
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文详细讲解了 Kubernetes Scale 的概念,并描述了如何使用 kubectl / Kuboard 对一个应用程序进行 伸缩 操作
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文详细讲解了 Kubernetes Rolling Update 的概念,并描述了如何使用 kubectl / Kuboard 对一个应用程序执行滚动更新。
|
||||
---
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: Kubernetes ConfigMap 可以将配置信息和容器镜像解耦,以使得容器化的应用程序可移植。本文提供了一系列的实例,解释如何通过 Kuboard 创建 ConfigMap 以及如何使用 ConfigMap 中的数据配置 Pod(容器组)。
|
||||
---
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍 Kubernetes Ingress 的概念,包括Ingress 基本概念、如何配置 Ingress Controller、如何使用 kubectl/Kuboard 操作 Ingress 信息
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: nfs
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍了存储卷 PersistentVolume,存储卷声明 PersistentVolumeClaim 的概念,他们的关系,以及如何使用
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍了存储类的概念及其使用
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍 Kubernetes 中 Volume(数据卷)的基本概念、用法以及支持的数据卷类型
|
||||
---
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 通过Kuboard 配置 Kubernetes,使用私有 registry 中的 docker 镜像
|
||||
---
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文描述了 Kubernetes Pod 中的初始化容器的概念、使用场景和使用方法。初始化容器是容器组中 app 容器启动之前执行的容器。可能包含 setup 脚本,或其他工具进程
|
||||
---
|
||||
|
||||
# Pod 初始化容器
|
||||
# 容器组 - 初始化容器
|
||||
|
||||
参考文档: Kubernetes 官网 [Init Containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/)
|
||||
|
||||
@ -100,4 +101,4 @@ Pod 重启时,所有的初始化容器都会重新执行,Pod 重启的原因
|
||||
* 改变任何一个初始化容器的镜像,将导致整个 Pod 重启
|
||||
* 改变工作容器的镜像,将只重启该工作容器,而不重启 Pod
|
||||
* Pod 容器基础设施被重启(例如 docker engine),这种情况不常见,通常只有 node 节点的 root 用户才可以执行此操作
|
||||
* Pod 中所有容器都已经结束,restartPolicy 是 Always,且初始化容器执行的记录已经被垃圾回收,此时将重启整个 Pod
|
||||
* Pod 中所有容器都已经结束,restartPolicy 是 Always,且初始化容器执行的记录已经被垃圾回收,此时将重启整个 Pod
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文描述了 Kubernetes 中 Pod 容器组的生命周期
|
||||
---
|
||||
|
||||
# Pod 生命周期
|
||||
# 容器组 - 生命周期
|
||||
|
||||
参考文档: Kubernetes 官网文档 [Pod Lifecycle](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/)
|
||||
|
||||
@ -40,9 +41,9 @@ phase 的可能取值有:
|
||||
| lastProbeTime <Badge text="Kuboard 暂不显示" type="warn"/> | 上一次针对 Pod 做健康检查/就绪检查的时间戳 |
|
||||
|
||||
|
||||
## Container probes
|
||||
## 容器的检查
|
||||
|
||||
Probe 是指 kubelet 周期性地探测容器的状况。有三种类型的 Probe:
|
||||
Probe 是指 kubelet 周期性地检查容器的状况。有三种类型的 Probe:
|
||||
|
||||
* <font color="#007af5">**ExecAction:**</font> 在容器内执行一个指定的命令。如果该命令的退出状态码为 0,则成功
|
||||
* <font color="#007af5">**TCPSocketAction:**</font> 探测容器的指定 TCP 端口,如果该端口处于 open 状态,则成功
|
||||
@ -84,7 +85,7 @@ Kuboard 可以在工作负载编辑器中配置健康检查/就绪检查,界
|
||||
$$ Pod and Container status
|
||||
-->
|
||||
|
||||
## Container States
|
||||
## 容器的状态
|
||||
|
||||
一旦 Pod 被调度到节点上,kubelet 便开始使用容器引擎(通常是 docker)创建容器。容器有三种可能的状态:Waiting / Running / Terminated:
|
||||
|
||||
@ -99,7 +100,7 @@ $$ Pod and Container status
|
||||
<!-- $$ Pod readiness gate
|
||||
Kuboard 暂不支持 -->
|
||||
|
||||
## Restart policy
|
||||
## 重启策略
|
||||
|
||||
定义 Pod 或工作负载时,可以指定 restartPolicy,可选的值有:
|
||||
|
||||
@ -110,7 +111,7 @@ Kuboard 暂不支持 -->
|
||||
restartPolicy 将作用于 Pod 中的所有容器。kubelete 将在五分钟内,按照递延的时间间隔(10s, 20s, 40s ......)尝试重启已退出的容器,并在十分钟后再次启动这个循环,直到容器成功启动,或者 Pod 被删除。
|
||||
|
||||
|
||||
## Pod lifetime
|
||||
## 容器组的存活期
|
||||
|
||||
通常,如果没有人或者控制器删除 Pod,Pod 不会自己消失。只有一种例外,那就是 Pod 处于 Scucceeded 或 Failed 的 phase,并超过了垃圾回收的时长(在 kubernetes master 中通过 terminated-pod-gc-threshold 参数指定),kubelet 自动将其删除。
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍 Kubernetes 中的最小可调度单元 Pod 容器组的概念,以及如何使用容器组
|
||||
---
|
||||
|
||||
# Pod 容器组
|
||||
# 容器组 - 概述
|
||||
|
||||
参考文档:Kubernetes 官方文档 [Pod Overview](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/) [Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/)
|
||||
|
||||
@ -87,7 +88,7 @@ Pod 为其成员容器提供了两种类型的共享资源:网络和存储
|
||||
Pod 本身并不会运行,Pod 仅仅是容器运行的一个环境
|
||||
:::
|
||||
|
||||
Pod 本身并不能自愈(self-heal)。如果一个 Pod 所在的 Node (节点)出现故障,或者调度程序自身出现故障,Pod 将被删除;同理,当因为节点资源不够或节点维护而驱逐 Pod 时,Pod 也将被删除。Kubernetes 通过引入 Controller(控制器)的概念来管理 Pod 实例。在 Kubernetes 中,更为推荐的做法是使用 Controller 来管理 Pod,而不是直接创建 Pod。
|
||||
Pod 本身并不能自愈(self-healing)。如果一个 Pod 所在的 Node (节点)出现故障,或者调度程序自身出现故障,Pod 将被删除;同理,当因为节点资源不够或节点维护而驱逐 Pod 时,Pod 也将被删除。Kubernetes 通过引入 Controller(控制器)的概念来管理 Pod 实例。在 Kubernetes 中,更为推荐的做法是使用 Controller 来管理 Pod,而不是直接创建 Pod。
|
||||
|
||||
## 容器组和控制器
|
||||
|
||||
@ -95,8 +96,8 @@ Pod 本身并不能自愈(self-heal)。如果一个 Pod 所在的 Node (
|
||||
* 水平扩展(运行 Pod 的多个副本)
|
||||
* rollout(版本更新)
|
||||
* self-healing(故障恢复)
|
||||
|
||||
例如:当一个节点出现故障,控制器可以自动地在另一个节点调度一个配置完全一样的 Pod,以替换故障节点上的 Pod。
|
||||
|
||||
例如:当一个节点出现故障,控制器可以自动地在另一个节点调度一个配置完全一样的 Pod,以替换故障节点上的 Pod。
|
||||
|
||||
在 Kubernetes 中,广泛使用的控制器有:
|
||||
|
||||
|
||||
8
learning/k8s-intermediate/workload/wl-cronjob.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文描述了 Kubernetes CronJob 的概念、行为及用法
|
||||
---
|
||||
|
||||
# 控制器 - CronJob
|
||||
|
||||
正在撰写...
|
||||
8
learning/k8s-intermediate/workload/wl-daemonset.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文描述了 Kubernetes DaemonSet 的概念、行为及用法
|
||||
---
|
||||
|
||||
# 控制器 - DaemonSet
|
||||
|
||||
正在撰写...
|
||||
8
learning/k8s-intermediate/workload/wl-deployment.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍了 Kubernetes Deployment 的概念、行为及使用方法
|
||||
---
|
||||
|
||||
# 控制器 - Deployment
|
||||
|
||||
正在撰写...
|
||||
8
learning/k8s-intermediate/workload/wl-job.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文描述了 Kubernetes Job 的概念、行为及用法
|
||||
---
|
||||
|
||||
# 控制器 - Job
|
||||
|
||||
正在撰写...
|
||||
8
learning/k8s-intermediate/workload/wl-statefulset.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文描述了 Kubernetes StatefulSet 的概念、行为及用法
|
||||
---
|
||||
|
||||
# 控制器 - StatefulSet
|
||||
|
||||
正在撰写...
|
||||
29
learning/k8s-intermediate/workload/workload.md
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: 本文介绍了 Kubernetes Controller(控制器)的概念,以及控制器的种类
|
||||
---
|
||||
|
||||
# 控制器 - 概述
|
||||
|
||||
Pod(容器组)是 Kubernetes 中最小的调度单元,您可以通过 kubectl 直接创建一个 Pod。Pod 本身并不能自愈(self-healing)。如果一个 Pod 所在的 Node (节点)出现故障,或者调度程序自身出现故障,Pod 将被删除;同理,当因为节点资源不够或节点维护而驱逐 Pod 时,Pod 也将被删除。
|
||||
|
||||
Kubernetes 通过引入 Controller(控制器)的概念来管理 Pod 实例。在 Kubernetes 中,您应该始终通过创建 Controller 来创建 Pod,而不是直接创建 Pod。控制器可以提供如下特性:
|
||||
* 水平扩展(运行 Pod 的多个副本)
|
||||
* rollout(版本更新)
|
||||
* self-healing(故障恢复)
|
||||
|
||||
例如:当一个节点出现故障,控制器可以自动地在另一个节点调度一个配置完全一样的 Pod,以替换故障节点上的 Pod。
|
||||
|
||||
在 Kubernetes 中,广泛使用的控制器有:
|
||||
|
||||
* [Deployment](./wl-deployment.html) <Badge text="Kuboard 已支持" type="success"/>
|
||||
* [StatefulSet](./wl-statefulset.html) <Badge text="Kuboard 已支持" type="success"/>
|
||||
* [DaemonSet](./wl-daemonset.html) <Badge text="Kuboard 已支持" type="success"/>
|
||||
|
||||
* [CronJob](./wl-cronjob.html) <Badge text="Kuboard 正在计划中" type="warn"/>
|
||||
* [Jobs - Run to Completion](./wl-job.html) <Badge text="Kuboard 正在计划中" type="warn"/>
|
||||
|
||||
* ReplicaSet <Badge text="Kuboard 暂不支持" type="warn"/>
|
||||
* ReplicationController <Badge text="Kuboard 暂不支持" type="warn"/>
|
||||
* Garbage Collection <Badge text="Kuboard 暂不支持" type="warn"/>
|
||||
* TTL Controller for Finished Resources <Badge text="Kuboard 暂不支持" type="warn"/>
|
||||