Skip to content

Commit

Permalink
离线安装 Kuboard-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohq committed Jul 25, 2021
1 parent a2e6ffc commit 1000755
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import defaults from './grid/utils/defaults'

import Comp from './comp/index'
import Cookies from 'js-cookie'
import VueClipboard from 'vue-clipboard2'

const VueFractionGrid = {
install (Vue, options) {
Expand All @@ -33,7 +34,7 @@ export default ({
router, // 当前应用的路由实例
siteData // 站点元数据
}) => {

Vue.use(VueClipboard)
Vue.use(BootstrapVue)
Vue.use(VueFractionGrid, {
approach: 'desktop-first',
Expand Down
120 changes: 120 additions & 0 deletions install/v3/install-in-k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ meta:

* 执行 Kuboard v3 在 K8S 中的安装

<b-card no-body>
<b-tabs content-class="mt-3" card pills>
<b-tab title="在线安装" active>

```sh
kubectl apply -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
# 您也可以使用下面的指令,唯一的区别是,该指令使用华为云的镜像仓库替代 docker hub 分发 Kuboard 所需要的镜像
Expand All @@ -30,6 +34,122 @@ meta:
如果您想要定制 Kuboard 的启动参数,请将该 YAML 文件下载到本地,并修改其中的 ConfigMap
:::

</b-tab>
<b-tab title="离线安装(K8S服务器不能访问公网)">

* 在您的镜像仓库服务中创建一个名为 `kuboard` 的 repository(harbor 中称之为项目、华为镜像仓库中称之为组织)
* 输入您镜像仓库地址及 repository 名称(替换输入框中 `registry.mycompayn.com` 为你的镜像仓库服务地址即可):
<b-input size="sm" v-model="privateRegistry" placeholder="例如:registry.mycompany.com/kuboard"></b-input>
* 将所需镜像导入到您的私有镜像仓库
<div class="language-sh line-numbers-mode" v-if="privateRegistry">
<pre class="language-sh">
<code>{{dockerPull}}</code>
</pre>
<div class="line-numbers-wrapper">
<span class="line-number">1</span><br>
<span class="line-number">2</span><br>
<span class="line-number">3</span><br>
<span class="line-number">4</span><br>
<span class="line-number">5</span><br>
<span class="line-number">6</span><br>
<span class="line-number">7</span><br>
<span class="line-number">8</span><br>
<span class="line-number">9</span><br>
<span class="line-number">10</span><br>
<span class="line-number">11</span><br>
<span class="line-number">12</span><br>
</div>
</div>
<b-alert v-else show variant="warning">请先输入私有镜像仓库</b-alert>

* 在您的镜像仓库设置导入的镜像为公开可访问(无需镜像仓库的用户名密码)
* 获取 YAML 文件,并将该文件保存到集群 master 节点(或者 kubectl 客户端所在机器,假设文件名为 `kuboard-v3.yaml`

<b-button variant="primary" @click="save">保存 YAML 到文件</b-button>
<b-button variant="outline-primary" v-clipboard:copy="resultYaml"
v-clipboard:success="onCopy">复制 YAML 到粘贴板</b-button>
* 执行安装指令
```sh
kubectl apply -f kuboard-v3.yaml
```

</b-tab>
</b-tabs>
</b-card>

<script>
import axios from 'axios'

function fakeClick(obj) {
var ev = document.createEvent("MouseEvents");
ev.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
obj.dispatchEvent(ev);
}

function exportRaw(name, data) {
var urlObject = window.URL || window.webkitURL || window;
var export_blob = new Blob([data]);
var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
save_link.href = urlObject.createObjectURL(export_blob);
save_link.download = name;
fakeClick(save_link);
}

export default {
data () {
return {
privateRegistry: 'registry.mycompany.com/kuboard',
originalYaml: '',
}
},
computed: {
dockerPull () {
return `docker pull eipwork/kuboard-agent:v3
docker pull eipwork/etcd-host:3.4.16-1
docker pull eipwork/kuboard:v3
docker pull questdb/questdb:6.0.4
docker tag eipwork/kuboard-agent:v3 ${this.privateRegistry}/kuboard-agent:v3
docker tag eipwork/etcd-host:3.4.16-1 ${this.privateRegistry}/etcd-host:3.4.16-1
docker tag eipwork/kuboard:v3 ${this.privateRegistry}/kuboard:v3
docker tag questdb/questdb:6.0.4 ${this.privateRegistry}/questdb:6.0.4
docker push ${this.privateRegistry}/kuboard-agent:v3
docker push ${this.privateRegistry}/etcd-host:3.4.16-1
docker push ${this.privateRegistry}/kuboard:v3
docker push ${this.privateRegistry}/questdb:6.0.4
`
},
resultYaml () {
let result = ''
result = this.originalYaml.replaceAll('eipwork/', this.privateRegistry + '/')
result = result.replaceAll('questdb/', this.privateRegistry + '/')
return result
}
},
mounted () {
axios.get('https://addons.kuboard.cn/kuboard/kuboard-v3.yaml', {}).then(resp => {
this.originalYaml = resp.data
}).catch(e => {
console.log(e)
})
},
methods: {
save () {
exportRaw('kuboard-v3.yaml', this.resultYaml)
},
onCopy () {
this.$bvToast.toast(`已将 YAML 复制到粘贴板`, {
title: '已复制',
variant: 'success',
autoHideDelay: 5000,
solid: true,
append: true,
toaster: 'b-toaster-top-center'
})
}
}
}
</script>

* 等待 Kuboard v3 就绪

执行指令 `watch kubectl get pods -n kuboard`,等待 kuboard 名称空间中所有的 Pod 就绪,如下所示,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
"animated-number-vue": "^1.0.0",
"aos": "^2.3.4",
"axios": "^0.19.2",
"js-cookie": "^2.2.1",
"babel-plugin-component": "^1.1.1",
"bootstrap": "^4.6.0",
"bootstrap-vue": "^2.21.2",
"date-fns": "^1.30.1",
"esm": "^3.2.25",
"js-cookie": "^2.2.1",
"reduce-css-calc": "^2.1.8",
"vue-clipboard2": "^0.3.1",
"vue2-animate": "^2.1.4",
"vuepress": "^1.8.2",
"vuepress-plugin-baidu-autopush": "^1.0.1",
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7539,6 +7539,13 @@ vue-class-component@^7.1.0:
resolved "https://registry.npm.taobao.org/vue-class-component/download/vue-class-component-7.2.3.tgz#a5b1abd53513a72ad51098752e2dedd499807cca"
integrity sha1-pbGr1TUTpyrVEJh1Li3t1JmAfMo=

vue-clipboard2@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/vue-clipboard2/-/vue-clipboard2-0.3.1.tgz#6e551fb7bd384889b28b0da3b12289ed6bca4894"
integrity sha512-H5S/agEDj0kXjUb5GP2c0hCzIXWRBygaWLN3NEFsaI9I3uWin778SFEMt8QRXiPG+7anyjqWiw2lqcxWUSfkYg==
dependencies:
clipboard "^2.0.0"

vue-functional-data-merge@^3.1.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/vue-functional-data-merge/download/vue-functional-data-merge-3.1.0.tgz#08a7797583b7f35680587f8a1d51d729aa1dc657"
Expand Down

0 comments on commit 1000755

Please sign in to comment.