Anka tutorial xx: Upgrade Record

1.升级前

从2018年11月到如今2019年11月,已经使用现有的版本1年多;anka也经历了多个版本,此次升级算是跨度较大,升级到目前最新的版本1.5.0

1.1 节点信息

hostname (节点名称) IP OS 组件
node1 192.168.55.xx linux anka-controller、anka-registry、etcd、beanstalk、 jenkins、sonarqube
node2 192.168.22.xx mac OS anka build

1.2 节点组件版本信息

Name Current Ver Upgrade to Ver Note
anka-controller 1.0.14-e7cc50b 1.5.0-ca87f665 自制image
etcd quay.io/coreos/etcd:v3.1.6 N/A https://quay.io/repository/coreos/etcd?tab=tags, 新版本需要 自制image
beanstalk schickling/beanstalkd N/A 新版本可不使用
anka-registry same as controller 1.5.0-ca87f665 自制image
Anka Build 1.4.3 2.1.2 N/A

1.2 组件端口变更信息

组件 升级前端口 升级后端口
anka-controller 8090 80
anka-registry 80 8089

根据节点的OS,提前下载安装包及相关文件 Anka Build Download page

2. 升级步骤

官网升级步骤链接: https://ankadoc.bitbucket.io/#upgrade-steps, 但是不够详细

2.1) On the mac nodes - run sudo ankacluster disjoin.

node 2 上操作
node2 $ sudo ankacluster disjoin -g

2.2) Install the new anka pkg on all the mac nodes.

node 2 上操作, 找到安装包,双击安装即可

2.3) Upgrade the guest addons inside the VM templates with anka start -u. Check the upgrade notes to see if this step is necessary.

node 2 上操作

1
2
3
4
#先切换到root用户,方便操作
#这个命令执行后会等待3min左右
node2:~ root# anka stop -f <VM_NAME>
node2:~ root# anka start -u <VM_NAME>

2.4) Push the newly upgraded VM templates to registry with anka registry push vmname –tag.

node 2 上操作
node2:~ root# anka registry push <VM_NAME> -d '<Message>' -t v100

2.5) Go to the Controller/Registry and upgrade.

node 1 上操作 ,之前的启动方式是docker-compose,根据yaml文件启动

anka 经过一年的开发升级,这块变动较大,比如:

    1. beanstalk 可以不使用了 (starting from anka version 2.0 beanstalk is not required, please configure the controller with the configuration that doesn’t use beanstalk)
    1. 端口的变化
    1. etcd由之前的 quay.io/coreos/etcd 镜像改为自己制作

提前备份 docker-compose.yml;先将下载包解压,结合老版本的docker-compose.yml文件,替换 services/ 目录下的相关文件

注意事项:

- etcd、registry 挂载的文件目录不可变动,不然影响旧的数据正常读取
- 替换docker-compose.yml的一些值

2.6) On the mac nodes - run sudo ankacluster join.

node 2 上操作
ankacluster join -g -n mac-mini-01 http://controller.anka.intranet.in2e.com:80

以上是官网提及的,但是与jenkins 集成中还需要更多的操作,以下作为补充

2.7) Change jenkins configuration.

  • 2.7.1 修改controller地址

  • 2.7.2 修改 anka VM templates
    升级后,测试发现 jenkins 日志中找不到vm templates;需要重新配置 VM templates

2.8) Change registry

升级后一天,再更新一个VM template时遇到问题

发现问题:
报错如下, 根据提示修改了多次命令的格式,但还是没有作用

1
2
anka registry push <VM_NAME> -d 'update new cert' -t v28
-anka: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19)

思考问题:
在root用户下 使用 anka registry list 时发现也报错,于是怀疑是 registry 的问题;由于端口的变更,导致 anka push VM 会有问题;需要删除,重新添加

尝试解决问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 先查看repo
node2:~ root# anka registry list-repos
++
++
anka (default)
+--------+-----------------------------------+
| host | controller.anka.intranet.xxx.com |
+--------+-----------------------------------+
| scheme | http |
+--------+-----------------------------------+
#删除
node2:~ root# anka registry delete anka
#新增
node2:~ root# anka registry add anka-repo http://192.168.55.xx:8089
#再次list,查看以下
node2:~ root# anka registry list-repos
++
++
anka-repo (default)
+--------+---------------+
| host | 192.168.55.xx |
+--------+---------------+
| scheme | http |
+--------+---------------+
| port | 8089 |
+--------+---------------+

一波操作后,终于可以正常 push VM, ~~~大坑


最后 —->记得修改Node上的 VM capacity
每次disjoin -> join 动作,这个值都会回到默认值 2;或者执行 ankacluster join 的时候可以用 -m 参数去指定
这个值的作用是,指定允许同时运行几个 mac OS 实例

主要记录 2019-11-20 左右升级 anka 的操作

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2019-2024 John Doe
  • Visitors: | Views:

请我喝杯咖啡吧~