StoryBook
This commit is contained in:
229
.vuepress/components/StoryBook.vue
Normal file
229
.vuepress/components/StoryBook.vue
Normal file
@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:title="$page.frontmatter.storyBook.title"
|
||||
:visible.sync="dialogVisible"
|
||||
custom-class="storybook-dialog"
|
||||
:fullscreen="true">
|
||||
<div slot="title" class="storybook-title">
|
||||
{{$page.frontmatter.storyBook.title}} -
|
||||
<el-tag type="danger">
|
||||
<span style="font-size: 14px;">{{slides[activeIndex] ? slides[activeIndex].title : ''}}</span>
|
||||
</el-tag>
|
||||
<el-button style="float: right; margin-right: 20px; virtical-align: top;" size="mini" type="text" @click="dialogVisible = false">全文阅读</el-button>
|
||||
</div>
|
||||
<swiper :options="swiperOption" ref="mySwiper" class="swiper-no-swiping">
|
||||
<swiper-slide v-for="(step, index) in slides" :key="step.name" class="swipe-slide-width swiper-no-swiping" :data-hash="step.name">
|
||||
<div :class="activeIndex === index ? 'slide-wrapper' : 'slide-wrapper noselect'"
|
||||
:disabled="activeIndex !== index"
|
||||
:style="activeIndex === index ? '' : 'cursor: pointer; opacity: 0.5;'">
|
||||
<div class="slide"
|
||||
@click.capture="clickNeighbour(index)"
|
||||
:id="`dialog_${step.name}`">
|
||||
<!-- <div :id="step.name">
|
||||
<slot :name="step.name">
|
||||
{{step.title}}
|
||||
</slot>
|
||||
</div> -->
|
||||
</div>
|
||||
<el-button v-if="activeIndex === index" style="float: left; z-index: 100; margin-top: 5px;" size="mini" type="primary" @click="clickNeighbour(index - 1)">上一步</el-button>
|
||||
<el-button v-if="activeIndex === index" style="float: right; z-index: 100; margin-top: 5px;" size="mini" type="primary" @click="clickNeighbour(index + 1)">下一步</el-button>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
<div class="swiper-pagination swiper-pagination-bullets swiper-pagination-custom swiper-no-swiping noselect" slot="pagination"></div>
|
||||
<!-- <div class="swiper-button-prev" slot="button-prev"></div>
|
||||
<div class="swiper-button-next" slot="button-next"></div> -->
|
||||
</swiper>
|
||||
</el-dialog>
|
||||
<el-button @click="dialogVisible = true" type="text" style="position: fixed; right: 20px; top: 60px;">分步阅读</el-button>
|
||||
<template v-for="(step, index) in slides">
|
||||
<div :key="step.name">
|
||||
<div :id="`full_${step.name}`">
|
||||
<div :id="step.name">
|
||||
<slot :name="step.name">
|
||||
{{step.title}}
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import 'swiper/dist/css/swiper.css'
|
||||
import { swiper, swiperSlide } from 'vue-awesome-swiper'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
let _this = this
|
||||
return {
|
||||
dialogVisible: false,
|
||||
activeIndex: 0,
|
||||
swiperOption: {
|
||||
hashNavigation: {
|
||||
watchState: true,
|
||||
},
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
// type: 'progressbar'
|
||||
renderBullet(index, className) {
|
||||
return `<span class="${className} swiper-pagination-bullet-custom">${index + 1}</span>`
|
||||
}
|
||||
},
|
||||
speed: 300,
|
||||
freeMode: false,
|
||||
slidesPerView: 'auto',
|
||||
centeredSlides: true,
|
||||
spaceBetween: 20,
|
||||
on:{
|
||||
slideChange: function(a){
|
||||
console.log('slideChange')
|
||||
_this.$nextTick(_ => {
|
||||
_this.activeIndex = _this.$refs.mySwiper.swiper.activeIndex
|
||||
})
|
||||
},
|
||||
},
|
||||
// observer:true,
|
||||
// navigation: {
|
||||
// nextEl: '.swiper-button-next',
|
||||
// prevEl: '.swiper-button-prev',
|
||||
// }
|
||||
},
|
||||
canSlideNext: true,
|
||||
slides: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// swiper() {
|
||||
// // if (this.$refs.mySwiper) {
|
||||
// return this.$refs.mySwiper.swiper
|
||||
// // } else {
|
||||
// // return { activeIndex: 0 }
|
||||
// // }
|
||||
// }
|
||||
},
|
||||
mounted () {
|
||||
this.$nextTick(_ => {
|
||||
for (let item of this.$page.frontmatter.storyBook.pages) {
|
||||
this.slides.push(item)
|
||||
}
|
||||
setTimeout(_ => {
|
||||
this.dialogVisible = this.$page.frontmatter.storyBook.initial === 'StoryBook'
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
components: {
|
||||
swiper, swiperSlide
|
||||
},
|
||||
watch: {
|
||||
dialogVisible () {
|
||||
if (this.dialogVisible) {
|
||||
setTimeout(_ => {
|
||||
for (let item of this.slides) {
|
||||
// console.log(`dialog_${item.name}`, document.getElementById(`dialog_${item.name}`))
|
||||
document.getElementById(`dialog_${item.name}`).appendChild(document.getElementById(item.name))
|
||||
}
|
||||
}, 100)
|
||||
} else {
|
||||
setTimeout(_ => {
|
||||
for (let item of this.slides) {
|
||||
// console.log(`full_${item.name}`, document.getElementById(`full_${item.name}`))
|
||||
document.getElementById(`full_${item.name}`).appendChild(document.getElementById(item.name))
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
activeLinkStyle(href) {
|
||||
if (this.$page.path.indexOf(href) === 0) {
|
||||
return 'border-bottom: 2px solid #0b85ff;'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
clickNeighbour (index) {
|
||||
if (index > this.activeIndex) {
|
||||
event.stopPropagation()
|
||||
event.preventDefault()
|
||||
if (this.$parent.canSlideNext) {
|
||||
let result = this.$parent.canSlideNext.apply(this.$parent, [this.slides[this.activeIndex].name])
|
||||
console.log(result)
|
||||
if (!result.flag) {
|
||||
this.$message.error(result.message)
|
||||
return
|
||||
} else {
|
||||
this.$refs.mySwiper.swiper.slideNext()
|
||||
}
|
||||
}
|
||||
} else if (index === this.activeIndex) {
|
||||
|
||||
} else if (index < this.activeIndex) {
|
||||
event.stopPropagation()
|
||||
event.preventDefault()
|
||||
this.$refs.mySwiper.swiper.slidePrev()
|
||||
}
|
||||
},
|
||||
next() {
|
||||
if (this.active++ >= this.$page.frontmatter.storyBook.pages.length) this.active = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.storybook-dialog {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
.storybook-title {
|
||||
color: #fff !important;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.storybook-dialog .el-dialog__body {
|
||||
padding: 0 0px;
|
||||
|
||||
}
|
||||
.swiper-pagination-custom {
|
||||
bottom: 10px !important;
|
||||
left: 300px !important;
|
||||
width: calc(100% - 600px) !important;
|
||||
}
|
||||
|
||||
.swiper-pagination-bullet-custom {
|
||||
width: 20px !important;
|
||||
height: 20px !important;
|
||||
text-align: center;
|
||||
line-height: 20px;
|
||||
font-size: 12px;
|
||||
color: #ffffff !important;
|
||||
opacity: 1 !important;
|
||||
background: rgba(0,0,0,0.3) !important;
|
||||
}
|
||||
.swiper-pagination-bullet-custom.swiper-pagination-bullet-active {
|
||||
color: #fff !important;
|
||||
background: #007af5 !important;
|
||||
}
|
||||
|
||||
.swipe-slide-width {
|
||||
width: calc(100vw - 200px);
|
||||
}
|
||||
|
||||
.slide-wrapper {
|
||||
height: calc(100vh - 55px);
|
||||
margin: 0 0px;
|
||||
}
|
||||
|
||||
.slide {
|
||||
background-color: #ffffff;
|
||||
/* border: 1px solid #d7dae2; */
|
||||
padding: 0 20px;
|
||||
height: calc(100vh - 95px);
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -14,7 +14,7 @@ module.exports = {
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
`],
|
||||
['script', {type: 'text/javascript', src: 'https://tajs.qq.com/stats?sId=66467492', charset: 'UTF-8'}]
|
||||
// ['script', {type: 'text/javascript', src: 'https://tajs.qq.com/stats?sId=66467492', charset: 'UTF-8'}]
|
||||
],
|
||||
markdown: {
|
||||
toc: { includeLevel: [2, 3] },
|
||||
|
||||
12
.vuepress/enhanceApp.js
Normal file
12
.vuepress/enhanceApp.js
Normal file
@ -0,0 +1,12 @@
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
|
||||
import Element from 'element-ui'
|
||||
|
||||
export default ({
|
||||
Vue, // VuePress 正在使用的 Vue 构造函数
|
||||
options, // 附加到根实例的一些选项
|
||||
router, // 当前应用的路由实例
|
||||
siteData // 站点元数据
|
||||
}) => {
|
||||
Vue.use(Element)
|
||||
}
|
||||
@ -3,4 +3,31 @@
|
||||
}
|
||||
p img {
|
||||
border: 1px solid #d7dae2;
|
||||
}
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-moz-user-select: -moz-none;
|
||||
-moz-user-select: none;
|
||||
-o-user-select:none;
|
||||
-khtml-user-select:none;
|
||||
-webkit-user-select:none;
|
||||
-ms-user-select:none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
}
|
||||
/*定义滚动条轨道 内阴影+圆角*/
|
||||
::-webkit-scrollbar-track {
|
||||
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 10px;
|
||||
}
|
||||
/*定义滑块 内阴影+圆角*/
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.42);
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ description: 详细介绍如何将 Kuboard 升级到最新版本。
|
||||
稳定版: latest, v1.0.1
|
||||
发布日期: 2019-08-20
|
||||
|
||||
测试版: v1.0.2-beta.2
|
||||
发布日期: 2019-08-24
|
||||
测试版: v1.0.2-beta.5
|
||||
发布日期: 2019-08-29
|
||||
|
||||
[查看更新日志](/overview/change-log.html)
|
||||
|
||||
|
||||
352
install/install-k8s-backup.md
Normal file
352
install/install-k8s-backup.md
Normal file
@ -0,0 +1,352 @@
|
||||
---
|
||||
description: Kubernetes 最新稳定版 v1.15.3 的快速安装文档。该文档由众多网友验证并在线提出修改意见、持续不断地更新和完善、并且通过 QQ 群提供免费在线答疑的服务。
|
||||
---
|
||||
|
||||
# 使用 kubeadm 安装 kubernetes v1.15.3
|
||||
|
||||
## 文档特点
|
||||
|
||||
**网上那么多 Kubernetes 安装文档,为什么这篇文档更有参考价值?**
|
||||
|
||||
* **众多网友验证**
|
||||
* 每天有超过 200 人参照此文档完成 Kubernetes 安装
|
||||
* 不断有网友对安装文档提出改进意见
|
||||
|
||||
* **持续更新和完善**
|
||||
* 始终有最新的 Kubernetes 稳定版安装文档,当前版本 v1.15.3
|
||||
* 当前已更新了 <font color="red"> 42 次 </font>, [查看更新历史](https://github.com/eip-work/kuboard-press/commits/master/install/install-k8s.md)
|
||||
|
||||
* **在线答疑** QQ 群
|
||||
|
||||

|
||||
|
||||
## 配置要求
|
||||
|
||||
对于 Kubernetes 初学者,推荐在阿里云采购如下配置:(您也可以使用自己的虚拟机、私有云等您最容易获得的 Linux 环境)
|
||||
[领取阿里云最高2000元红包](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=obezo3pg)
|
||||
|
||||
* 3台 **2核4G** 的ECS(突发性能实例 t5 ecs.t5-c1m2.large或同等配置,单台约 0.4元/小时,停机时不收费)
|
||||
* **Cent OS 7.6**
|
||||
|
||||
**安装后的软件版本为**
|
||||
|
||||
* Kubernetes v1.15.3
|
||||
* calico 3.8.2
|
||||
* nginx-ingress 1.5.3
|
||||
* Docker 18.09.7
|
||||
|
||||
> 如果要安装 Kubernetes 历史版本,请参考:
|
||||
> * [安装 Kubernetes v1.15.2 单Master节点](/install/history-k8s/install-k8s-1.15.2.html)
|
||||
> * [安装 Kubernetes v1.15.1 单Master节点](/install/history-k8s/install-k8s-1.15.1.html)
|
||||
|
||||
安装后的拓扑图如下:<span v-on:click="downloadDiagram"><a :href="$withBase('/kuboard.rp')" download="www.kuboard.cn.rp">下载拓扑图源文件</a></span> <font color="#999">使用Axure RP 9.0可打开该文件</font>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
downloadDiagram () {
|
||||
console.log('尝试发送 ga event')
|
||||
if (window.ga) {
|
||||
window.ga('send', {
|
||||
hitType: 'event',
|
||||
eventCategory: '安装K8S',
|
||||
eventAction: 'Download',
|
||||
eventLabel: '下载拓扑图源文件'
|
||||
});
|
||||
console.log('发送成功 ga event')
|
||||
} else {
|
||||
console.log('开发环境,不发送 ga event')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||

|
||||
|
||||
::: tip
|
||||
**关于二进制安装**
|
||||
|
||||
网上一直流传着一种 ***“二进制”*** 安装 Kubernetes 的方法,查了许久,未曾在 kubernetes.io 官方网站上看到任何关于此安装方法的介绍,也并没有看到任何关于 ***“二进制”*** 安装的优势,唯一的解释是:
|
||||
> 由于众所周知的原因,在国内无法直接访问Google的服务。二进制包由于其下载方便、灵活定制而深受广大kubernetes使用者喜爱,成为企业部署生产环境比较流行的方式之一
|
||||
|
||||
鉴于目前已经有比较方便的办法获得 kubernetes 镜像,我将回避 ***二进制*** 安装是否更好的争论。本文采用 kubernetes.io 官方推荐的 kubeadm 工具安装 kubernetes 集群。
|
||||
|
||||
:::
|
||||
|
||||
## 检查 centos / hostname
|
||||
|
||||
``` sh
|
||||
# 在 master 节点和 worker 节点都要执行
|
||||
cat /etc/redhat-release
|
||||
|
||||
# 此处 hostname 的输出将会是该机器在 Kubernetes 集群中的节点名字
|
||||
# 不能使用 localhost 作为节点的名字
|
||||
hostname
|
||||
|
||||
# 请使用 lscpu 命令,核对 CPU 信息
|
||||
# Architecture: x86_64 本安装文档不支持 arm 架构
|
||||
# CPU(s): 2 CPU 内核数量不能低于 2
|
||||
lscpu
|
||||
```
|
||||
|
||||
::: danger 注意
|
||||
* 请使用兼容的 centos 版本
|
||||
* hostname 不能为 localhost
|
||||
* CPU 内核数量不能低于 2
|
||||
:::
|
||||
|
||||
**操作系统兼容性**
|
||||
|
||||
| CentOS 版本 | 本文档是否兼容 | 备注 |
|
||||
| ----------- | --------------------------------------- | ----------------------------------- |
|
||||
| 7.6 | <span style="font-size: 24px;">😄</span> | 已验证 |
|
||||
| 7.5 | <span style="font-size: 24px;">😄</span> | 已验证 |
|
||||
| 7.4 | <span style="font-size: 24px;">🤔</span> | 待验证 |
|
||||
| 7.3 | <span style="font-size: 24px;">🤔</span> | 待验证 |
|
||||
| 7.2 | <span style="font-size: 24px;">😞</span> | 已证实会出现 kubelet 无法启动的问题 |
|
||||
|
||||
## 安装 docker / kubelet
|
||||
|
||||
使用 root 身份在所有节点执行如下代码,以安装软件:
|
||||
- docker
|
||||
- nfs-utils
|
||||
- kubectl / kubeadm / kubelet
|
||||
|
||||
:::: tabs type:border-card
|
||||
|
||||
::: tab 快速安装 lazy
|
||||
|
||||
``` sh
|
||||
# 在 master 节点和 worker 节点都要执行
|
||||
|
||||
curl -sSL https://kuboard.cn/install-script/v1.15.3/install-kubelet.sh | sh
|
||||
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: tab 手动安装 lazy
|
||||
|
||||
手动执行以下代码,效果与快速安装完全相同。
|
||||
|
||||
<<< @/.vuepress/public/install-script/v1.15.3/install-kubelet.sh
|
||||
|
||||
::: warning
|
||||
如果此时执行 `service status kubelet` 命令,将得到 kubelet 启动失败的错误提示,请忽略此错误,因为必须完成后续步骤中 kubeadm init 的操作,kubelet 才能正常启动
|
||||
:::
|
||||
|
||||
::::
|
||||
|
||||
## 初始化 master 节点
|
||||
|
||||
::: tip
|
||||
* 以 root 身份在 demo-master-a-1 机器上执行
|
||||
* 初始化 master 节点时,如果因为中间某些步骤的配置出错,想要重新初始化 master 节点,请先执行 `kubeadm reset` 操作
|
||||
:::
|
||||
|
||||
::: warning
|
||||
* POD_SUBNET 所使用的网段不能与 ***master节点/worker节点*** 所在的网段重叠。该字段的取值为一个 <a href="/glossary/cidr.html" target="_blank">CIDR</a> 值,如果您对 CIDR 这个概念还不熟悉,请不要修改这个字段的取值 10.100.0.1/20
|
||||
:::
|
||||
|
||||
:::: tabs type:border-card
|
||||
|
||||
::: tab 快速初始化 lazy
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
# 替换 x.x.x.x 为 master 节点实际 IP(请使用内网 IP)
|
||||
# export 命令只在当前 shell 会话中有效,开启新的 shell 窗口后,如果要继续安装过程,请重新执行此处的 export 命令
|
||||
export MASTER_IP=x.x.x.x
|
||||
# 替换 apiserver.demo 为 您想要的 dnsName (不建议使用 master 的 hostname 作为 APISERVER_NAME)
|
||||
export APISERVER_NAME=apiserver.demo
|
||||
export POD_SUBNET=10.100.0.1/20
|
||||
echo "${MASTER_IP} ${APISERVER_NAME}" >> /etc/hosts
|
||||
curl -sSL https://kuboard.cn/install-script/v1.15.3/init-master.sh | sh
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: tab 手工初始化 lazy
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
# 替换 x.x.x.x 为 master 节点实际 IP(请使用内网 IP)
|
||||
# export 命令只在当前 shell 会话中有效,开启新的 shell 窗口后,如果要继续安装过程,请重新执行此处的 export 命令
|
||||
export MASTER_IP=x.x.x.x
|
||||
# 替换 apiserver.demo 为 您想要的 dnsName (不建议使用 master 的 hostname 作为 APISERVER_NAME)
|
||||
export APISERVER_NAME=apiserver.demo
|
||||
export POD_SUBNET=10.100.0.1/20
|
||||
echo "${MASTER_IP} ${APISERVER_NAME}" >> /etc/hosts
|
||||
```
|
||||
|
||||
<<< @/.vuepress/public/install-script/v1.15.3/init-master.sh
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
|
||||
|
||||
**检查 master 初始化结果**
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
|
||||
# 执行如下命令,等待 3-10 分钟,直到所有的容器组处于 Running 状态
|
||||
watch kubectl get pod -n kube-system -o wide
|
||||
|
||||
# 查看 master 节点初始化结果
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 初始化 worker节点
|
||||
|
||||
### 获得 join命令参数
|
||||
|
||||
**在 master 节点上执行**
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
kubeadm token create --print-join-command
|
||||
```
|
||||
|
||||
可获取kubeadm join 命令及参数,如下所示
|
||||
|
||||
``` sh
|
||||
# kubeadm token create 命令的输出
|
||||
kubeadm join apiserver.demo:6443 --token mpfjma.4vjjg8flqihor4vt --discovery-token-ca-cert-hash sha256:6f7a8e40a810323672de5eee6f4d19aa2dbdb38411845a1bf5dd63485c43d303
|
||||
```
|
||||
|
||||
|
||||
### 初始化worker
|
||||
|
||||
**针对所有的 worker 节点执行**
|
||||
|
||||
``` sh
|
||||
# 只在 worker 节点执行
|
||||
# 替换 ${MASTER_IP} 为 master 节点实际 IP
|
||||
# 替换 ${APISERVER_NAME} 为初始化 master 节点时所使用的 APISERVER_NAME
|
||||
echo "${MASTER_IP} ${APISERVER_NAME}" >> /etc/hosts
|
||||
|
||||
# 替换为 master 节点上 kubeadm token create 命令的输出
|
||||
kubeadm join apiserver.demo:6443 --token mpfjma.4vjjg8flqihor4vt --discovery-token-ca-cert-hash sha256:6f7a8e40a810323672de5eee6f4d19aa2dbdb38411845a1bf5dd63485c43d303
|
||||
```
|
||||
|
||||
### 检查初始化结果
|
||||
|
||||
在 master 节点上执行
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
kubectl get nodes
|
||||
```
|
||||
输出结果如下所示:
|
||||
```sh
|
||||
[root@demo-master-a-1 ~]# kubectl get nodes
|
||||
NAME STATUS ROLES AGE VERSION
|
||||
demo-master-a-1 Ready master 5m3s v1.15.3
|
||||
demo-worker-a-1 Ready <none> 2m26s v1.15.3
|
||||
demo-worker-a-2 Ready <none> 3m56s v1.15.3
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 移除 worker 节点
|
||||
|
||||
::: warning
|
||||
正常情况下,您无需移除 worker 节点,如果添加到集群出错,您可以移除 worker 节点,再重新尝试添加
|
||||
:::
|
||||
|
||||
在准备移除的 worker 节点上执行
|
||||
|
||||
``` sh
|
||||
# 只在 worker 节点执行
|
||||
kubeadm reset
|
||||
```
|
||||
|
||||
在 master 节点 demo-master-a-1 上执行
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
kubectl delete node demo-worker-x-x
|
||||
```
|
||||
|
||||
::: tip
|
||||
* 将 demo-worker-x-x 替换为要移除的 worker 节点的名字
|
||||
* worker 节点的名字可以通过在节点 demo-master-a-1 上执行 kubectl get nodes 命令获得
|
||||
:::
|
||||
|
||||
|
||||
## 安装 Ingress Controller
|
||||
|
||||
:::: tabs type:border-card
|
||||
|
||||
::: tab 安装IngressController lazy
|
||||
|
||||
**在 master 节点上执行**
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
kubectl apply -f https://kuboard.cn/install-script/v1.15.3/nginx-ingress.yaml
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: tab 卸载IngressController lazy
|
||||
|
||||
**在 master 节点上执行**
|
||||
|
||||
只在您想选择其他 Ingress Controller 的情况下卸载
|
||||
|
||||
``` sh
|
||||
# 只在 master 节点执行
|
||||
kubectl delete -f https://kuboard.cn/install-script/v1.15.3/nginx-ingress.yaml
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: tab YAML文件 lazy
|
||||
|
||||
<<< @/.vuepress/public/install-script/v1.15.3/nginx-ingress.yaml
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
|
||||
|
||||
**配置域名解析**
|
||||
|
||||
将域名 *.demo.yourdomain.com 解析到 demo-worker-a-2 的 IP 地址 z.z.z.z (也可以是 demo-worker-a-1 的地址 y.y.y.y)
|
||||
|
||||
**验证配置**
|
||||
|
||||
在浏览器访问 a.demo.yourdomain.com,将得到 404 NotFound 错误页面
|
||||
|
||||
::: tip 提示
|
||||
|
||||
许多初学者在安装 Ingress Controller 时会碰到问题,请不要灰心,可暂时跳过 ***安装 Ingress Controller*** 这个部分,等您学完 www.kuboard.cn 上 [Kubernetes 入门](/learning/k8s-basics/kubernetes-basics.html) 以及 [通过互联网访问您的应用程序](/learning/k8s-intermediate/ingress.html) 这两部分内容后,再来回顾 Ingress Controller 的安装。
|
||||
|
||||
:::
|
||||
|
||||
::: warning
|
||||
如果您打算将 Kubernetes 用于生产环境,请参考此文档 [Installing Ingress Controller](https://github.com/nginxinc/kubernetes-ingress/blob/v1.5.3/docs/installation.md),完善 Ingress 的配置
|
||||
:::
|
||||
|
||||
|
||||
## 下一步
|
||||
:tada: :tada: :tada:
|
||||
|
||||
您已经完成了 Kubernetes 集群的安装,下一步请:
|
||||
|
||||
[安装 Kuboard](/install/install-dashboard.html)
|
||||
|
||||
安装 Kuboard 之前先
|
||||
<a target="_blank" :href="`http://demo.kuboard.cn/#/dashboard?k8sToken=${$site.themeConfig.kuboardToken}`">
|
||||
在线体验 Kuboard
|
||||
</a>
|
||||
|
||||
::: tip
|
||||
* Kubernetes 初学者,[点击这里获取 Kubernetes 学习路径](/overview/#kubernetes-%E5%88%9D%E5%AD%A6%E8%80%85)
|
||||
:::
|
||||
@ -1,9 +1,89 @@
|
||||
---
|
||||
# layout: StepLayout
|
||||
description: Kubernetes 最新稳定版 v1.15.3 的快速安装文档。该文档由众多网友验证并在线提出修改意见、持续不断地更新和完善、并且通过 QQ 群提供免费在线答疑的服务。
|
||||
storyBook:
|
||||
title: '使用 kubeadm 安装 kubernetes v1.15.3'
|
||||
initial: StoryBook
|
||||
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.15.3
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data () {
|
||||
let validateEnv = (rule, value, callback) => {
|
||||
console.log('validate', value)
|
||||
if (value.length < 3) {
|
||||
callback(new Error('请确认您的环境符合上述条件'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
form: {
|
||||
checked: []
|
||||
},
|
||||
rules: {
|
||||
checked: [{validator: validateEnv, trigger: 'change'}]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'form.checked' () {
|
||||
if (this.form.checked.length === 3) {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
downloadDiagram () {
|
||||
console.log('尝试发送 ga event')
|
||||
if (window.ga) {
|
||||
window.ga('send', {
|
||||
hitType: 'event',
|
||||
eventCategory: '安装K8S',
|
||||
eventAction: 'Download',
|
||||
eventLabel: '下载拓扑图源文件'
|
||||
});
|
||||
console.log('发送成功 ga event')
|
||||
} else {
|
||||
console.log('开发环境,不发送 ga event')
|
||||
}
|
||||
},
|
||||
canSlideNext (currentName) {
|
||||
if (currentName === 'step1' && this.form.checked.length < 3) {
|
||||
this.$refs.envForm.validate(valid => {
|
||||
|
||||
})
|
||||
return { flag: false, message: '请确认您的环境符合要求的条件' }
|
||||
}
|
||||
return { flag: true, message: 'can slide next' }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<StoryBook>
|
||||
<div slot="introduction">
|
||||
|
||||
## 文档特点
|
||||
|
||||
**网上那么多 Kubernetes 安装文档,为什么这篇文档更有参考价值?**
|
||||
@ -20,6 +100,9 @@ description: Kubernetes 最新稳定版 v1.15.3 的快速安装文档。该文
|
||||
|
||||

|
||||
|
||||
</div>
|
||||
<div slot="overview" style="min-height: 800px;">
|
||||
|
||||
## 配置要求
|
||||
|
||||
对于 Kubernetes 初学者,推荐在阿里云采购如下配置:(您也可以使用自己的虚拟机、私有云等您最容易获得的 Linux 环境)
|
||||
@ -41,29 +124,12 @@ description: Kubernetes 最新稳定版 v1.15.3 的快速安装文档。该文
|
||||
|
||||
安装后的拓扑图如下:<span v-on:click="downloadDiagram"><a :href="$withBase('/kuboard.rp')" download="www.kuboard.cn.rp">下载拓扑图源文件</a></span> <font color="#999">使用Axure RP 9.0可打开该文件</font>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
downloadDiagram () {
|
||||
console.log('尝试发送 ga event')
|
||||
if (window.ga) {
|
||||
window.ga('send', {
|
||||
hitType: 'event',
|
||||
eventCategory: '安装K8S',
|
||||
eventAction: 'Download',
|
||||
eventLabel: '下载拓扑图源文件'
|
||||
});
|
||||
console.log('发送成功 ga event')
|
||||
} else {
|
||||
console.log('开发环境,不发送 ga event')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- <img src="./install-k8s.assets/image-20190826000521999.png" style="width: 958px; height: 533px"></img> -->
|
||||
|
||||
|
||||
::: tip
|
||||
**关于二进制安装**
|
||||
|
||||
@ -74,6 +140,9 @@ export default {
|
||||
|
||||
:::
|
||||
|
||||
</div>
|
||||
<div slot="step1">
|
||||
|
||||
## 检查 centos / hostname
|
||||
|
||||
``` sh
|
||||
@ -90,10 +159,16 @@ hostname
|
||||
lscpu
|
||||
```
|
||||
|
||||
::: danger 注意
|
||||
* 请使用兼容的 centos 版本
|
||||
* hostname 不能为 localhost
|
||||
* CPU 内核数量不能低于 2
|
||||
::: warning 必须符合下述条件
|
||||
<el-form :model="form" ref="envForm" :rules="rules">
|
||||
<el-form-item prop="checked">
|
||||
<el-checkbox-group v-model="form.checked">
|
||||
* <el-checkbox label="centos">我的任意节点 centos 版本在兼容列表中</el-checkbox>
|
||||
* <el-checkbox label="hostname">我的任意节点 hostname 不是 localhost</el-checkbox>
|
||||
* <el-checkbox label="cpu">我的任意节点 CPU 内核数量大于等于 2</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
:::
|
||||
|
||||
**操作系统兼容性**
|
||||
@ -106,6 +181,10 @@ lscpu
|
||||
| 7.3 | <span style="font-size: 24px;">🤔</span> | 待验证 |
|
||||
| 7.2 | <span style="font-size: 24px;">😞</span> | 已证实会出现 kubelet 无法启动的问题 |
|
||||
|
||||
</div>
|
||||
|
||||
<div slot="step2">
|
||||
|
||||
## 安装 docker / kubelet
|
||||
|
||||
使用 root 身份在所有节点执行如下代码,以安装软件:
|
||||
@ -138,6 +217,10 @@ curl -sSL https://kuboard.cn/install-script/v1.15.3/install-kubelet.sh | sh
|
||||
|
||||
::::
|
||||
|
||||
</div>
|
||||
|
||||
<div slot="step3">
|
||||
|
||||
## 初始化 master 节点
|
||||
|
||||
::: tip
|
||||
@ -199,7 +282,9 @@ watch kubectl get pod -n kube-system -o wide
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div slot="step4">
|
||||
|
||||
## 初始化 worker节点
|
||||
|
||||
@ -278,6 +363,9 @@ kubectl delete node demo-worker-x-x
|
||||
* worker 节点的名字可以通过在节点 demo-master-a-1 上执行 kubectl get nodes 命令获得
|
||||
:::
|
||||
|
||||
</div>
|
||||
|
||||
<div slot="step5">
|
||||
|
||||
## 安装 Ingress Controller
|
||||
|
||||
@ -335,6 +423,11 @@ kubectl delete -f https://kuboard.cn/install-script/v1.15.3/nginx-ingress.yaml
|
||||
:::
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div slot="step6">
|
||||
|
||||
|
||||
## 下一步
|
||||
:tada: :tada: :tada:
|
||||
|
||||
@ -350,3 +443,7 @@ kubectl delete -f https://kuboard.cn/install-script/v1.15.3/nginx-ingress.yaml
|
||||
::: tip
|
||||
* Kubernetes 初学者,[点击这里获取 Kubernetes 学习路径](/overview/#kubernetes-%E5%88%9D%E5%AD%A6%E8%80%85)
|
||||
:::
|
||||
|
||||
|
||||
</div>
|
||||
</StoryBook>
|
||||
|
||||
34
package-lock.json
generated
34
package-lock.json
generated
@ -3437,6 +3437,14 @@
|
||||
"integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=",
|
||||
"dev": true
|
||||
},
|
||||
"dom7": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npm.taobao.org/dom7/download/dom7-2.1.3.tgz",
|
||||
"integrity": "sha1-pzb5w7+8TKA5qBzQlfl9HX894Zw=",
|
||||
"requires": {
|
||||
"ssr-window": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"domain-browser": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npm.taobao.org/domain-browser/download/domain-browser-1.2.0.tgz",
|
||||
@ -6875,8 +6883,7 @@
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
|
||||
"dev": true
|
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||
},
|
||||
"object-copy": {
|
||||
"version": "0.1.0",
|
||||
@ -9464,6 +9471,11 @@
|
||||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"ssr-window": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npm.taobao.org/ssr-window/download/ssr-window-1.0.1.tgz",
|
||||
"integrity": "sha1-MHUqakZm53Z/C35qpvwv29DZs2k="
|
||||
},
|
||||
"ssri": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npm.taobao.org/ssri/download/ssri-6.0.1.tgz",
|
||||
@ -9766,6 +9778,15 @@
|
||||
"util.promisify": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"swiper": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npm.taobao.org/swiper/download/swiper-4.5.0.tgz",
|
||||
"integrity": "sha1-TYcL7E9avi+yWTJYSd0mQckkPA0=",
|
||||
"requires": {
|
||||
"dom7": "^2.1.3",
|
||||
"ssr-window": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"tapable": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npm.taobao.org/tapable/download/tapable-1.1.3.tgz",
|
||||
@ -10387,6 +10408,15 @@
|
||||
"integrity": "sha1-pysaQqTYKnIepDjRtr9V5mGVxjc=",
|
||||
"dev": true
|
||||
},
|
||||
"vue-awesome-swiper": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-awesome-swiper/download/vue-awesome-swiper-3.1.3.tgz",
|
||||
"integrity": "sha1-BVALUB/7P+yb9+uZhbz0roNg7Z4=",
|
||||
"requires": {
|
||||
"object-assign": "^4.1.1",
|
||||
"swiper": "^4.0.7"
|
||||
}
|
||||
},
|
||||
"vue-hot-reload-api": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.3.tgz",
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"vuepress-plugin-sitemap": "^2.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"element-ui": "^2.11.1"
|
||||
"element-ui": "^2.11.1",
|
||||
"vue-awesome-swiper": "^3.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user