Create readme.md

pull/122/head
StarsL.cn 2023-10-08 16:51:57 +08:00 committed by GitHub
parent 3da0076ff0
commit 27d8a1afc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 0 deletions

33
install/readme.md Normal file
View File

@ -0,0 +1,33 @@
## 2023-10-8前使用该脚本在K8S部署consul的同学请注意.
1. 完成第3步操作前不要删除consul的pod,也不要重启consul
2. 使用kubectl进入conusl的容器`kubectl exec -i -t -n tensuns consul-0 -c consul -- sh -c "sh"`
3. 备份consul的KV存储数据
```
consul kv export --http-addr=http://127.0.0.1:8500 -token=$(cat /consul/config/consul.hcl|grep agent|awk -F\" '{print $2}') '' > /consul/data/consul_kv_bak.json
```
4. 修改consul的Stateful Sets的yaml文件, 找到`image`字段下面, 增加`args`部分:
```
args:
- agent
```
- 增加完成后应该是如下效果:
```
...
containers:
- name: consul
image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/consul:latest
args:
- agent
ports:
- name: http
containerPort: 8500
protocol: TCP
...
```
5. 保存后重启consul的Stateful Sets
6. 启动完成后再次使用第2步进入consul容器
7. 恢复consul的KV存储数据
```
consul kv import --http-addr=http://127.0.0.1:8500 -token=$(cat /consul/config/consul.hcl|grep agent|awk -F\" '{print $2}') @/consul/data/consul_kv_bak.json
```
8. 完成,可再次重启consul后,验证consul kv数据是否丢失(能正常登录TenSunS说明KV数据正常).