optimization

This commit is contained in:
huanqing.shao
2019-10-23 23:22:38 +08:00
parent afd41acbb0
commit ba09871630
26 changed files with 180 additions and 38 deletions

View File

@ -57,13 +57,21 @@ export default {
weight: 50
},
{
name: '宝塔面板',
description: '一键全能 Linux 部署及管理',
strong: '送你3188元礼包',
action: '点我领取',
url: 'https://www.bt.cn/?invite_code=MV9vdnlveno=',
name: '阳明的博客',
description: 'Kubernetes',
strong: '实战课程',
action: '去看看',
url: 'https://www.qikqiak.com/post/promotion-51/',
weight: 50
}
},
// {
// name: '宝塔面板',
// description: '一键全能 Linux 部署及管理,',
// strong: '送你3188元礼包',
// action: '点我领取',
// url: 'https://www.bt.cn/?invite_code=MV9vdnlveno=',
// weight: 50
// }
]
}
},

View File

@ -34,6 +34,7 @@ export default {
urls: [
{name: 'sealos官网', url: 'http://store.lameleg.com?referrer=shaohq', icon: 'https://hugo-picture.oss-cn-beijing.aliyuncs.com/blog/2019-08-27-044824.jpg'},
{name: '云原生实验室', url: 'https://www.yangcs.net/', icon: 'https://hugo-picture.oss-cn-beijing.aliyuncs.com/favicon-32x32.png'},
{name: '阳明的博客', url: 'https://www.qikqiak.com/', icon: 'https://bxdc-static.oss-cn-beijing.aliyuncs.com/images/favicon.png'},
]
}
}

View File

@ -68,7 +68,7 @@ module.exports = {
// },
'@vssue/vuepress-plugin-vssue': {
// set `platform` rather than `api`
platform: 'github-v4',
platform: 'github',
locale: 'zh-CN',
autoCreateIssue: false,
admins: ['shaohq'],
@ -436,6 +436,7 @@ module.exports = {
'k8s-intermediate/config/sec-ctx/con-kuboard',
]
},
'k8s-intermediate/config/priority-preemption',
]
}
]
@ -498,6 +499,13 @@ module.exports = {
'k8s-advanced/policy/rq_example_obj',
]
},
// {
// title: 'Pod Security',
// collapsable: true,
// children: [
// 'k8s-advanced/policy/sec',
// ]
// },
]
},
]

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -1,10 +1,10 @@
<template>
<div class="page-nav" style="max-width: 1000px; padding: 1rem;">
<el-divider>在线答疑</el-divider>
<el-divider>免费在线答疑</el-divider>
<grid :rwd="{compact: 'stack'}">
<grid-item size="1/3" :rwd="{tablet: '1/1', compact: '1/1'}" >
<el-card style="height: 100%; margin-top: 1rem;" shadow="none" :body-style="{padding: '0rem 1.5rem'}">
<h4>QQ群免费</h4>
<h4>QQ群</h4>
<div>
<Qq/> 808894550
</div>
@ -15,12 +15,12 @@
</grid-item>
<grid-item size="2/3" :rwd="{tablet: '1/1', compact: '1/1'}">
<el-card style="height: 100%; color: #2c3e50; line-height: 1.7; margin-top: 1rem;" shadow="none" :body-style="{padding: '0rem 1.5rem'}">
<h4>微信群即时</h4>
<h4>微信群</h4>
<div>
<div style="margin-top: 10px;">
<span>第一个二维码完成打赏扫第二个加微信进群聊请发送打赏截图</span>
<p style="margin-top: 10px; margin-bottom: 0; text-align-last: justify;">
<img src="/images/dz.png" style="width: 150px;"></img>
<span>二维码加微信进群聊群主会要求您分享图片到朋友圈</span>
<p style="margin-top: 10px; margin-bottom: 0; text-align: center;">
<!-- <img src="/images/dz.png" style="width: 150px;"></img> -->
<img src="/images/dz2.jpeg" style="width: 150px;"></img>
</p>
</div>

View File

@ -30,7 +30,7 @@
</a>
<span class="home-link noselect" style="line-height: 2.2em; font-size: 1em; font-weight: 400;">
<a href="/learning/">
<span style="color: #42b983;">提供K8S免费教程</span>
<span style="color: #42b983;">免费提供K8S教程</span>
</a>
<StarCount style="margin-left: 10px;"></StarCount>
<a href="https://webscan.qianxin.com/safe/detail/?query=kuboard.cn"><img border="0" src="https://webscan.qianxin.com/api/authcode?code=ab3ebe0592248d28477251ecaf72154f" style="display: none;"/></a>

View File

@ -8,7 +8,7 @@
<div style="display: inline-block; vertical-align: top; line-height: 1.6rem;">
<li>
<span style="color: red; font-weight: 500;">免费</span>
Kubernetes 教程绝不降低品质
Kubernetes教程K8S教程绝不降低品质
</li>
<li>
鼓励作者尽快完成 Kubernetes 教程 <span style="color: red; font-weight: 500;">剩下的 {{$themeConfig.incompleteRatio}}% </span>
@ -18,11 +18,11 @@
<li>
<Qq></Qq>
群号: 808894550
<span style="font-weight: 500;">在线答疑</span>
初学者可选择在线课程语言更通俗
<span style="font-weight: 500;">在线答疑</span>
<!-- 初学者可选择在线课程语言更通俗
<span @click="$sendGaEvent('极客时间', '极客时间', '极客时间:' + $page.path)">
<a target="_blank" href="https://time.geekbang.org/column/intro/100015201?code=MH1Wu456g0ZsrKtQI7QidivKV2hVvzerAUxDz5pOuQs%3D">深入剖析Kubernetes</a>
</span>
</span> -->
</li>
</div>
</div>

View File

@ -81,7 +81,7 @@ module.exports = siteData => {
selfTitle = page.frontmatter.titlePrefix + '_' + selfTitle
}
if (page.path.indexOf('/learning/') === 0) {
return selfTitle + '_Kubernetes教程_学习K8S'
return selfTitle + '_Kubernetes教程_K8S教程_K8S培训'
}
if (page.path.indexOf('/install/') === 0) {
return selfTitle + '_K8S安装部署'

View File

@ -5,10 +5,10 @@ sidebarDepth: 0
description: 本教程的主要依据是Kubernetes官网文档以及使用Kubernetes落地SpringCloud微服务并投产的实战经验在线答疑。适用人群_ Kubernetes 初学者_学习过 Kubernetes但在投产过程中仍有诸多疑虑和困惑的技术爱好者
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes 教程,K8S 教程
content: K8S教程,K8S 教程,K8S培训,Kubernetes培训
---
# Kubernetes免费中文教程
# Kubernetes教程K8S培训
<AdSenseTitle>
@ -143,3 +143,5 @@ meta:
* 多环境
* [导出部署配置](/learning/k8s-practice/ocp/export.html)
* [导入部署配置](/learning/k8s-practice/ocp/import.html)
Kuboard提供免费K8S教程、K8S培训

View File

@ -0,0 +1,30 @@
---
vssueId: 147
layout: LearningLayout
description: Kubernetes教程_通过Pod安全策略_您可以在更细的颗粒度上授权您的用户执行Pod的创建和更新的操作
meta:
- name: keywords
content: Kubernetes 教程,Resource Quota,ResourceQuota
---
# 概述
<AdSenseTitle >
> 参考文档:[Pod Security Policies](https://kubernetes.io/docs/concepts/policy/pod-security-policy/)
**FEATURE STATE** `Kubernetes v1.16` <Badge type="warning">beta</Badge>
通过Pod安全策略_您可以在更细的颗粒度上授权您的用户执行Pod的创建和更新的操作
* [概述](#概述)
* [激活Pod安全策略](#激活Pod安全策略)
</AdSenseTitle>
## 概述
`Pod Security Policy` 是一个集群级别(不在任何名称空间中)的 Kubernetes 对象它控制了Pod定义中安全敏感的一些内容。`Pod Security Policy` 对象可以定义一系列 Condition条件只有当这些 Condition条件满足时Pod才可以在系统中运行同时`Pod Security Policy`
## 激活Pod安全策略

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文详细讲解了Kubernetes_Deployment的概念_并描述了如何使用kubectl_Kuboard创建一个Deployment
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Deployment,Kubernetes入门,K8S入门
content: Kubernetes教程,K8S教程,Deployment,K8S培训,Kubernetes培训
---
# 1.部署一个应用程序

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文介绍了如何使用kubectl_Kuboard查看和浏览Kubernetes上的节点_容器组_部署等信息_并依据这些信息作出问题诊断
meta:
- name: keywords
content: Kubernetes教程,K8S教程,容器组,Kubernetes入门,K8S入门
content: Kubernetes教程,K8S教程,容器组,,K8S培训,Kubernetes培训
---
# 2.查看Pods/Nodes

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文详细讲解了Kubernetes_Service的概念_并描述了如何使用kubectl_Kuboard创建一个Service_以使得部署在Kubernetes上的容器可以被访问
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes Service,Kubernetes入门,K8S入门
content: Kubernetes教程,K8S教程,Kubernetes Service,K8S培训,Kubernetes培训
---
# 3.公布应用程序

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_以gif动图的形式形象的描述Kubernetes核心概念_本文将会简单介绍Kubernetes的核心概念_因为这些定义可以在Kubernetes的文档中找到_所以文章也会避免用大段的枯燥的文字介绍_相反_我们会使用一些图表其中一些是动画和示例来解释这些概念
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes入门,K8S入门
content: Kubernetes教程,K8S教程,K8S培训,Kubernetes培训
---
# 6.复习Kubernetes核心概念

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文为初学者介绍了一套最合适的Kubernetes入门教程_该教程源自于Kubernetes官方网站_作者对其进行了翻译_并根据初学者的理解情况做了适当的改写
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes入门,K8S入门
content: Kubernetes教程,K8S教程,K8S培训,Kubernetes培训
---
# 0.学习Kubernetes基础知识

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文详细讲解了Kubernetes_Scale的概念_并描述了如何使用_kubectl_Kuboard_对一个应用程序进行伸缩操作
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes入门,K8S入门,Kubernetes Scale
content: Kubernetes教程,K8S教程,K8S培训,Kubernetes培训,Kubernetes Scale
---
# 4.伸缩应用程序

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文详细讲解了Kubernetes_Rolling_Update_的概念_并描述了如何使用_kubectl_Kuboard_对一个应用程序执行滚动更新。
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes入门,K8S入门,滚动更新
content: Kubernetes教程,K8S教程,K8S培训,Kubernetes培训,滚动更新
---
# 5.执行滚动更新

View File

@ -0,0 +1,85 @@
---
vssueId: 148
layout: LearningLayout
description: Kubernetes教程_通过Pod安全策略_您可以在更细的颗粒度上授权您的用户执行Pod的创建和更新的操作
meta:
- name: keywords
content: Kubernetes 教程,Resource Quota,ResourceQuota
---
# Pod 优先权
<AdSenseTitle >
> 参考文档:[Pod Priority and Preemption](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/)
**FEATURE STATE** `Kubernetes v1.14` <Badge>stable</Badge>
Pod 中可以定义 优先级 `priority`,用于标识该 Pod 相对于其他 Pod 的重要程度。当存在 Pod 等待调度时(处于 Pending 状态调度器将尝试抢占preempt 或 驱逐 evict低优先级priority的 Pod以便调度 Pending 中的 Pod。
自 Kubernetes 1.9 开始Priority 也会对如下两个场景产生影响:
* Pod 的调度顺序
* 资源耗尽时,从节点上驱逐 Pod 的顺序
Pod 优先权priority and preemption的特性在 Kubernetes 1.11 中是 beta状态并默认激活在1.14 中是 GAGenerally Available 正式发布)状态。如下表所示:
| Kubernetes Version | Priority and Preemption State | Enabled by default |
| ------------------ | ----------------------------- | ------------------ |
| 1.8 | alpha | no |
| 1.9 | alpha | no |
| 1.10 | alpha | no |
| 1.11 | beta | yes |
| 1.14 | stable | yes |
::: danger 警告
如果集群中的用户并不是全部可信,可能会出现一些恶意的用户,创建最高优先级的 Pod使得其他的 Pod 被驱逐或者不能正常调度。可以通过在 [ResourceQuota](/learning/k8s-advanced/policy/rq.html) 中指定 priority 来解决此问题。
:::
[[TOC]]
</AdSenseTitle>
## 使用Pod优先权
在 Kubernetes v1.11 及以后的版本中参考下面的步骤启用Pod优先权Pod priority and preemption
1. 添加一个或多个 [PriorityClass](#priorityclass)
2. 创建Pod时指定 [priorityClassName](#pod-priority) 为其中一个 PriorityClass。通常在 Deployment/StatefulSet等 的 `spec.template.spec.priorityClassName` 中指定,而不是直接创建 Pod
如果你尝试过该特性之后,想要将其禁用,你必须在 API Server 和 Scheduler 的命令行启动参数中移除 `PodPriority` 参数,或者将其设置为 `false`。禁用该特性之后:
* 已经创建的 Pod 将保留 priority 字段但是抢占行为preemption)被禁用了,且 priority 字段也将被忽略
* 新创建的 Pod 将不能在设置 `priorityClassName` 字段
## 如何禁用 preemtion
> preemption英文愿意为先买权此处可以理解为抢占行为
::: tip
在 Kubernetes 1.12+,当前集群资源不足时,关键的 Pod 将依赖于抢占权才能被调度。因此,并不建议禁用 preemption
:::
::: tip
在 Kubernetes 1.15+,如果 `NonPreemptingPriority` 被启用了PriorityClass 可以设置为 `preemptionPolicy: Never`,此时,该 PriorityClass 的所有 Pod 将不会抢占preempty其他 Pod 的资源
:::
在 Kubernetes 1.11+preemption 由 kube-scheduler 的参数 `disablePreemption` 设置,默认为 `false`。如果在您已经知晓上面的提示的情况下,仍然要禁用 preemption可以将 `disablePreemption` 参数设置为 `true`
该参数需要通过 YAML 文件配置,而不能通过命令行参数设定。示例配置如下所示:
``` yaml {8}
apiVersion: kubescheduler.config.k8s.io/v1alpha1
kind: KubeSchedulerConfiguration
algorithmSource:
provider: DefaultProvider
...
disablePreemption: true
```
## PriorityClass
待续 ...
## Pod priority

View File

@ -16,7 +16,7 @@ meta:
Secret 中的信息可以通过 `kubectl get secret` 命令获取。例如,执行命令 `kubectl get secret mysecret -o yaml
` 可获取前面章节中所创建的 Secret输出信息如下
```
``` yaml
apiVersion: v1
kind: Secret
metadata:

View File

@ -34,7 +34,9 @@ Ingress Controller (通常需要负载均衡器配合)负责实现 Ingress A
2. Ingress Controller 根据请求的域名 `a.kuboard.cn` 和路径 `abc` 匹配集群中所有的 Ingress 信息,并最终找到 `Ingress B` 中有这个配置,其对应的 Service 为 `Service B``9080` 端口
3. Ingress Controller 通过 kube-proxy 将请求转发到 `Service B` 对应的任意一个 Pod 上 与 `Service B``9080` 端口对应的容器端口上。(从 Ingress Controller 到 Pod 的负载均衡由 kube-proxy + Service 实现)
<img src="./ingress.assets/image-20190910222649193.png" style="border: 1px solid #d7dae2; max-width: 720px;" alt="Kubernetes教程Ingress及其Controller"></img>
<p style="max-width: 720px;">
<img src="./ingress.assets/image-20190910222649193.png" alt="Kubernetes教程Ingress及其Controller"></img>
</p>
## Ingress Controller

View File

@ -4,7 +4,7 @@ layout: LearningLayout
description: Kubernetes教程_本文描述了一个经典微服务参考架构_并且通过三个视图集群概览、名称空间、工作负载理解微服务与Kubernetes的映射关系。
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes微服务
content: Kubernetes教程,K8S教程,Kubernetes微服务,K8S培训,K8S教程
---
# 从微服务视角看Kubernetes

View File

@ -1,10 +1,11 @@
---
vssueId: 68
layout: LearningLayout
metaTitle: Spring Cloud on KubernetesK8S教程/K8S培训
description: Kubernetes教程_微服务参考架构_包含微服务运行时_构建及测试_部署及运维_监控及评估__设计和研发Kuboard的初心便源于此SpringCloud微服务参考架构。
meta:
- name: keywords
content: Kubernetes教程,K8S教程,Kubernetes微服务,Kubernetes Spring Cloud
content: Kubernetes教程,K8S教程,Kubernetes微服务,K8S培训
---
# Spring Cloud on Kubernetes
@ -47,9 +48,3 @@ Spring Cloud on Kubernetes 并不对 Spring Cloud 架构、组件等做过多解
为了更好地阐述此主题,作者准备了一个最简单的微服务 example 作为例子,该 example 只实现了对一张简单数据库表执行 CRUD 操作的功能,该 example 的部署架构如下图所示,源代码请参考 [kuboard-example](https://github.com/eip-work/kuboard-example),您也可以直接通过 Kuboard [导入 example 微服务](/guide/example/import.html)
![Kubernetes教程SpringCloud Example](./README.assets/image-20190801063223432.png)
<div>
<script type='text/javascript' src='https://www.wjx.top/handler/jqemed.ashx?activity=43409534&width=760&source=iframe'></script>
</div>

10
package-lock.json generated
View File

@ -820,6 +820,16 @@
"resolved": "https://registry.npm.taobao.org/@types/q/download/@types/q-1.5.2.tgz",
"integrity": "sha1-aQoUdbhPKohP0HzXl8APXzE1bqg="
},
"@vssue/api-github-v3": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/@vssue/api-github-v3/download/@vssue/api-github-v3-1.1.2.tgz",
"integrity": "sha1-JEZ6b2LqrikJHphhYLWKqFnYd/Q=",
"dev": true,
"requires": {
"@vssue/utils": "^1.1.1",
"axios": "^0.18.1"
}
},
"@vssue/api-github-v4": {
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/@vssue/api-github-v4/download/@vssue/api-github-v4-1.2.0.tgz",

View File

@ -4,6 +4,7 @@
"docs:build": "vuepress build ."
},
"devDependencies": {
"@vssue/api-github-v3": "^1.1.2",
"@vssue/api-github-v4": "^1.2.0",
"@vssue/vuepress-plugin-vssue": "^1.2.0",
"@vuepress/plugin-active-header-links": "^1.0.0-rc.1",