From 27d8a1afc4cbe9c0cbf1c3117105d8844cc78295 Mon Sep 17 00:00:00 2001 From: "StarsL.cn" Date: Sun, 8 Oct 2023 16:51:57 +0800 Subject: [PATCH] Create readme.md --- install/readme.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 install/readme.md diff --git a/install/readme.md b/install/readme.md new file mode 100644 index 0000000..9e30f65 --- /dev/null +++ b/install/readme.md @@ -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数据正常).