This commit is contained in:
huanqing.shao
2019-11-03 23:04:29 +08:00
parent c7ca6dc076
commit d227a6badd
6 changed files with 93 additions and 40 deletions

View File

@ -5,7 +5,7 @@ module.exports = [
strong: '一键离线安装',
action: '去看看',
url: 'http://store.lameleg.com?referrer=shaohq',
weight: 20
weight: 5
},
{
name: '阳明的博客',
@ -13,7 +13,7 @@ module.exports = [
strong: '实战课程',
action: '去看看',
url: 'https://www.qikqiak.com/post/promotion-51/',
weight: 50
weight: 5
},
{
name: '极客时间',
@ -21,8 +21,25 @@ module.exports = [
strong: 'DevOps实战笔记',
action: '去看看',
url: 'https://time.geekbang.org/column/intro/100036601?code=0Totv3yN%2FohiumTclUF4ky4qRYs9Ecq6ZK4IdgNf88M%3D',
weight: 30
weight: 10
},
{
name: '腾讯云',
description: '腾讯云11.11爆款1核2G云服务器首购88元免费领9888元代金券',
strong: '百款云产品一折起',
action: '去抢',
url: 'https://cloud.tencent.com/act/cps/redirect?redirect=1050&cps_key=2ee6baa049659f4713ddc55a51314372&from=console',
weight: 40
},
{
name: '阿里云',
description: '双十一All in Cloud',
strong: '低至一折',
action: '去抢',
url: 'https://www.aliyun.com/1111/2019/home?userCode=obezo3pg',
weight: 40
}
// {
// name: '宝塔面板',
// description: '一键全能 Linux 部署及管理,',

View File

@ -209,6 +209,13 @@ module.exports = {
'k8s-intermediate/workload/wl-job/usage',
'k8s-intermediate/workload/wl-job/when',
]
},
{
title: '控制器 - CronJob',
collapsable: true,
children: [
'k8s-intermediate/workload/wl-cronjob/',
]
}
]
},

View File

@ -6,44 +6,18 @@ description: Kubernete安装文档_Kubernetes最新稳定版v1.16.2的快速安
meta:
- name: keywords
content: Kubernetes安装,K8S安装,kubeadm,Kubernetes 安装,K8S 安装
# storyBook:
# title: '使用 kubeadm 安装 kubernetes v1.16.2单Master节点'
# initial: FullPage
# pages:
# - name: introduction
# title: 文档特点
# - name: overview
# title: 配置要求
# - name: step1
# title: 检查环境
# - name: step2
# title: 安装 docker/kubelet
# - name: step3
# title: 初始化 master 节点
# - name: step4
# title: 初始化 worker 节点
# - name: step5
# title: 安装 Ingress Controller
# - name: step6
# title: 总结
---
# 使用kubeadm安装kubernetes_v1.16.2
<AdSenseTitle/>
<!-- <StoryBook>
<div slot="introduction"> -->
## 文档特点
<div style="min-height: 612px;">
<InstallBanner version="v1.16.2" updateCount="65"/>
</div>
<!-- </div>
<div slot="overview" style="min-height: 800px;"> -->
## 配置要求
对于 Kubernetes 初学者,推荐在阿里云或腾讯云采购如下配置:(您也可以使用自己的虚拟机、私有云等您最容易获得的 Linux 环境)
@ -56,13 +30,13 @@ meta:
<div>
[领取腾讯云最高2860元代金券](https://cloud.tencent.com/act/cps/redirect?redirect=1040&cps_key=2ee6baa049659f4713ddc55a51314372&from=console)
[腾讯云11.11爆款1核2G云服务器首购88元免费领9888元代金券百款云产品一折起](https://cloud.tencent.com/act/cps/redirect?redirect=1050&cps_key=2ee6baa049659f4713ddc55a51314372&from=console)
[腾讯云限时1折秒杀](https://cloud.tencent.com/act/cps/redirect?redirect=1044&cps_key=2ee6baa049659f4713ddc55a51314372&from=console)
<!-- [腾讯云限时1折秒杀](https://cloud.tencent.com/act/cps/redirect?redirect=1044&cps_key=2ee6baa049659f4713ddc55a51314372&from=console) -->
[领取阿里云最高2000元红包](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=obezo3pg)
[阿里云双十一All in Cloud低至一折](https://www.aliyun.com/1111/2019/home?userCode=obezo3pg)
[阿里云服务器限时2折](https://www.aliyun.com/acts/limit-buy?userCode=obezo3pg)
<!-- [阿里云服务器限时2折](https://www.aliyun.com/acts/limit-buy?userCode=obezo3pg) -->
**安装后的软件版本为**

View File

@ -47,13 +47,14 @@ kubernetes 安装有多种选择,本文档描述的集群安装具备如下特
* 三个 master 组成主节点集群,通过内网 loader balancer 实现负载均衡;至少需要三个 master 节点才可组成高可用集群,否则会出现 ***脑裂*** 现象
* 多个 worker 组成工作节点集群,通过外网 loader balancer 实现负载均衡
[领取腾讯云最高2860元代金券](https://cloud.tencent.com/act/cps/redirect?redirect=1040&cps_key=2ee6baa049659f4713ddc55a51314372&from=console)
[腾讯云11.11爆款1核2G云服务器首购88元免费领9888元代金券百款云产品一折起](https://cloud.tencent.com/act/cps/redirect?redirect=1050&cps_key=2ee6baa049659f4713ddc55a51314372&from=console)
[腾讯云限时1折秒杀](https://cloud.tencent.com/act/cps/redirect?redirect=1044&cps_key=2ee6baa049659f4713ddc55a51314372&from=console)
<!-- [腾讯云限时1折秒杀](https://cloud.tencent.com/act/cps/redirect?redirect=1044&cps_key=2ee6baa049659f4713ddc55a51314372&from=console) -->
[领取阿里云最高2000元红包](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=obezo3pg)
[阿里云双十一All in Cloud低至一折](https://www.aliyun.com/1111/2019/home?userCode=obezo3pg)
<!-- [阿里云服务器限时2折](https://www.aliyun.com/acts/limit-buy?userCode=obezo3pg) -->
[阿里云服务器限时2折](https://www.aliyun.com/acts/limit-buy?userCode=obezo3pg)
安装后的拓扑图如下:<span v-on:click="$sendGaEvent('下载拓扑图-kubernetes', '下载拓扑图-kubernetes', 'Download-install-kubernetes.html')"> <a :href="$withBase('/kuboard.rp')" download="www.kuboard.cn.rp" >下载拓扑图源文件</a> </span> <font color="#999">使用Axure RP 9.0可打开该文件</font>

View File

@ -1,8 +1,52 @@
---
vssueId: 151
layout: LearningLayout
description: 本文描述了 Kubernetes CronJob 的概念、行为及用法
description: Kubernetes 的控制器模式中,
meta:
- name: keywords
content: Kubernetes教程,K8S教程,K8S培训,Kubernetes Job
---
# 控制器 - CronJob
# CronJob
正在撰写...
<AdSenseTitle>
> 参考文档: [CronJob](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/)
CronJob 按照预定的时间计划schedule创建 [Job](../wl-job/)。一个 CronJob 对象类似于 crontab (cron table) 文件中的一行记录。该对象根据 [Cron](https://en.wikipedia.org/wiki/Cron) 格式定义的时间计划,周期性地创建 Job 对象。
::: tip Schedule
所有 CronJob 的 `schedule` 中所定义的时间,都是基于 master 所在时区来进行计算的。
:::
</AdSenseTitle>
## Example
请参考 [执行CronJob](./run.html)
## CronJob 的限制
一个 CronJob 在时间计划中的每次执行时刻,都创建 **大约** 一个 Job 对象。这里用到了 **大约** ,是因为在少数情况下会创建两个 Job 对象,或者不创建 Job 对象。尽管 K8S 尽最大的可能性避免这种情况的出现但是并不能完全杜绝此现象的发生。因此Job 程序必须是 [幂等的](/glossary/idempotent.html)。
当以下两个条件都满足时Job 将至少运行一次:
* `startingDeadlineSeconds` 被设置为一个较大的值,或者不设置该值(默认值将被采纳)
* `concurrencyPolicy` 被设置为 `Allow`
对于每一个 CronJobCronJob 控制器将检查自上一次执行的时间点到现在为止有多少次执行被错过了。如果错过的执行次数超过了 100则 CronJob 控制器将不再创建 Job 对象,并记录如下错误:
```
Cannot determine if job needs to be started. Too many missed start time (> 100). Set or decrease .spec.startingDeadlineSeconds or check clock skew.
```
非常重要的一点是,如果设置了 `startingDeadlineSeconds` (非空 `nil`),控制器将按照从 `startingDeadlineSeconds` 秒之前到现在为止的时间段计算被错过的执行次数,而不是按照从上一次执行的时间点到现在为止的时间段来计算被错过的执行次数。例如,如果 `startingDeadlineSeconds` 被设置为 `200`,则,控制器将计算过去 200 秒内,被错过的执行次数。
当 CronJob 在其计划的时间点应该创建 Job 时却创建失败,此时 CronJob 被认为错过了一次执行。例如,如果 `concurrencyPolicy` 被设置为 `Forbid` 且 CronJob 上一次创建的 Job 仍然在运行,此时 CronJob 再次遇到一个新的计划执行的时间点并尝试创建一个 Job该此创建尝试将失败并被认为错过了一次执行。
又例如,假设某个 CronJob 被设置为:自 `08:30:00` 开始,每分钟创建一个新的 Job且 CronJob 的 `startingDeadlineSeconds` 字段未被设置。如果 CronJob 控制器恰好在 `08:29:00` 到 `10:21:00` 这个时间段出现故障(例如 Crash则该 CronJob 将不会再次执行,因为其错过的执行次数已经超过了 100。
为了进一步解释这个概念,我们再列举一个例子,假设某个 CronJob 被设置为:自 `08:30:00` 开始,每分钟创建一个新的 Job且 CronJob 的 `startingDeadlineSeconds` 字段被设置为 200 秒。同样,如果 CronJob 控制器恰好在 `08:29:00` 到 `10:21:00` 这个时间段出现故障(时间段与上个例子相同),此时 CronJob 控制器将在 `10:22:00` 为该 CronJob 创建一个 Job。这是因为在这个例子中控制器将只计算过去 200 秒中错过的执行次数(大约 3 次),而不是从上一次执行的时间点开始计算错过的执行次数。
CronJob 只负责按照时间计划的规定创建 Job 对象,由 Job 来负责管理具体 Pod 的创建和执行。

View File

@ -0,0 +1,10 @@
---
vssueId: 151
layout: LearningLayout
description: Kubernetes 的控制器模式中,
meta:
- name: keywords
content: Kubernetes教程,K8S教程,K8S培训,Kubernetes Job
---
# 执行CronJob