Skip to content

Commit 96741ed

Browse files
committed
doc: Provide an offline installation method for Helm. (#7729)
Signed-off-by: chaojidage <[email protected]>
1 parent 69d27a3 commit 96741ed

File tree

1 file changed

+120
-1
lines changed

1 file changed

+120
-1
lines changed

i18n/zh-cn/user-docs/installation/install-with-helm/install-kubeblocks-with-helm.md

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ KubeBlocks 是基于 Kubernetes 的原生应用,你可以使用 Helm 来进行
4949

5050
## 安装步骤
5151

52-
**使用 Helm 安装 KubeBlocks**
52+
**在线安装 KubeBlocks**
5353

5454
1. 创建 CRD 依赖。
5555

@@ -95,6 +95,125 @@ KubeBlocks 是基于 Kubernetes 的原生应用,你可以使用 Helm 来进行
9595

9696
:::
9797

98+
**离线安装 KubeBlocks**
99+
100+
在生产环境中,K8S 集群一般是不能连接外网的,只会允许办公环境的电脑通过 VPN 连接 K8S 集群。在线安装方式不可用,需要进行离线安装。
101+
## 环境准备
102+
103+
<table>
104+
<tr>
105+
<td colspan="3">1. K8S 集群中有可用的镜像仓库(假定为registry.kb)</td>
106+
</tr >
107+
<tr>
108+
<td colspan="3">2. K8S 的部署节点安装 helm</td>
109+
</tr >
110+
</table>
111+
总得来说就是将在线的crd , helm-charts,公有云镜像下载下来,然后helm install安装
112+
113+
1. 下载crd并安装
114+
1. 办公电脑访问下面地址,会自动下载 crd 文件
115+
```bash
116+
https://github.com/apecloud/kubeblocks/releases/download/v0.8.4-beta.11/kubeblocks_crds.yaml
117+
```
118+
2. 将文件上传到集群中,并安装 crd
119+
```bash
120+
kubectl create -f crds.yaml // 这里假定下载为 crds.yaml
121+
```
122+
123+
2. 下载远程 helmchart 文件
124+
```bash
125+
helm repo add kubeblocks https://apecloud.github.io/helm-charts
126+
127+
helm repo update
128+
129+
helm fetch kubeblocks/kubeblocks --version 0.8.4-beta.11 // 这里指定了版本为 0.8.4-beta.11
130+
```
131+
3. 将仓库的 repo 改成集群可用的仓库,这里假定可用的是 registry.kb
132+
1. 将下载的 helmchart 包解压,会得到一个 kubeblocks 的文件夹,进入后修改 value.yaml
133+
```bash
134+
tar zxvf kubeblocks-0.8.4-beta.11
135+
```
136+
2. 改对应的 repo
137+
```bash
138+
## KubeBlocks container image settings
139+
##
140+
## @param image.registry KubeBlocks image registry
141+
## @param image.repository KubeBlocks image repository
142+
## @param image.pullPolicy KubeBlocks image pull policy
143+
## @param image.tag KubeBlocks image tag (immutable tags are recommended)
144+
## @param image.imagePullSecrets KubeBlocks image pull secrets
145+
## @param image.tools.repository KubeBlocks tools image repository
146+
image:
147+
registry: registry.kb //换成可用的 registry
148+
repository: apecloud/kubeblocks
149+
pullPolicy: IfNotPresent
150+
# Overrides the image tag whose default is the chart appVersion.
151+
tag: ""
152+
imagePullSecrets: []
153+
tools:
154+
repository: apecloud/kubeblocks-tools
155+
datascript:
156+
repository: apecloud/kubeblocks-datascript
157+
158+
159+
160+
## @param addonChartsImage - addon charts image, used to copy Helm charts to the addon job container.
161+
## @param addonChartsImage.chartsPath - the helm charts path in the addon charts image.
162+
addonChartsImage:
163+
# if the value of addonChartsImage.registry is not specified using `--set`, it will be set to the value of 'image.registry' by default
164+
registry: "registry.kb" // 换成可用的 registry
165+
repository: apecloud/kubeblocks-charts
166+
pullPolicy: IfNotPresent
167+
tag: ""
168+
chartsPath: /charts
169+
pullSecrets: []
170+
```
171+
4. 将需要的远程镜像重新 tag 推到 K8S 的镜像仓库
172+
1. 基本需要的镜像是下面这几个
173+
```bash
174+
infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/kubeblocks-datascript:0.8.4-beta.11
175+
infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/kubeblocks-tools:0.8.4-beta.11
176+
infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/kubeblocks:0.8.4-beta.11
177+
infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/snapshot-controller:v6.2.1
178+
infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/kubeblocks-charts:0.8.4-beta.11
179+
```
180+
2. 将他们重新 tag 后推到远端(以kubeblocks:0.8.4-beta.11举例)
181+
```bash
182+
docker pull infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/kubeblocks:0.8.4-beta.11
183+
docker tag infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/kubeblocks:0.8.4-beta.11 registry.kb/apecloud/kubeblocks:0.8.4-beta.11
184+
docker push registry.kb/apecloud/kubeblocks:0.8.4-beta.11
185+
```
186+
后续有需要的镜像也可以按照上面的方式添加
187+
188+
5. 可以将部分自动安装的 addon 关闭,只保留需要的
189+
190+
在kubeblocks/templates/addons 文件夹中,将对应的数据库的配置中的 autoInstall 改成 false(以 apecloud-mysql-addo.yaml举例)
191+
```bash
192+
{{- $selectorLabels := include "kubeblocks.selectorLabels" . }}
193+
{{- include "kubeblocks.buildAddonCR" (merge (dict
194+
"kbVersion" ">=0.7.0"
195+
"selectorLabels" $selectorLabels
196+
"name" "apecloud-mysql"
197+
"version" "0.8.0-beta.8"
198+
"model" "RDBMS"
199+
"provider" "apecloud"
200+
"description" "ApeCloud MySQL is a database that is compatible with MySQL syntax and achieves high availability through the utilization of the RAFT consensus protocol."
201+
"autoInstall" false ) .) -}} // 将原本的 true 改成false
202+
```
203+
6. 部署
204+
205+
将原本的 kubeblocks 文件夹打包上传至集群部署节点
206+
```bash
207+
tar czvf kb0.8.4beta11.tgz kubeblocks
208+
helm install kubeblocks kubeblocks/. --create-namespace kb-system
209+
```
210+
:::note
211+
212+
中间有问题需要卸载的时候,一定要使用 helm uninstall 的方式,不能使用删除 kb-system 命名空间的方式,因为部分资源不在 kb-system 下,会导致异常。比如设置某些数据库自动安装的开关失效
213+
214+
:::
215+
216+
98217
## 验证 KubeBlocks 安装
99218

100219
执行以下命令来检查 KubeBlocks 是否已成功安装。

0 commit comments

Comments
 (0)