2021年3月9日,VMware正式发布vSphere 7.0 U2,随着该版本的发布,VMware在容器云的支持上更进一步,宣布支持WCP和AVI结合。
AVI在被VMware收购以后,改名为NSX Advanced Load Balance,相对与NSX-T内置的LB功能,AVI在弹性/性能/使用范围等方面强出很多。此次作为TANZU系列产品的助力,V记将其集成进来,称为vSphere with Tanzu Integrated Load Balancing。

注:vSphere with Tanzu就是太平洋计划中的WCP,笔者比较习惯称WCP了

vSphere with Tanzu Integrated Load Balancing


如上图所示:

  • AVI可以和vSphere with Tanzu, TKG Cluster Control Plane一起提供Kubernetes Ingress的LB服务
  • 通过网络服务和NSX-T进行组织编排
  • 高度可用性和可扩展
  • 升级和生命周期的自动管理

在本文中,将对vSphere 7 U2 + NSX-T环境进行AVI集成,验证其集成效果。

实验

环境

在这里插入图片描述
如上图所示,VC,AVI,NSX-T的环境和WCP环境已经安装好,也生成了两个Namespace。

名称版本备注
vCenter7.0u210.105.130.18
AVI Controller20.1.310.105.130.55
AKO1.3.1
NSX-T3.110.105.130.21
WCP ControlPlane VM10.105.130.51-54

跳板机使用CentOS 7,WCP的Supervisor ControlPlane VM上安装AKO将借助于内置Harbor。

前提

Prerequisites for install:

  • A private container registry to upload the AKO docker image
  • helm > 3.0 CLI installed.

步骤

使用Harbor

启用Harbor

在WCP上启动Harbor在前面文章中详细描述和实验,vSphere with K8S下使用Harbor
在这里插入图片描述
启动好Harbor以后在Cluster的配置中可以看到Harbor UI,它使用WCP一致的用户名/密码登录,在这使用的是administrator@vsphere.local

为AVI配置专用Namespace

AKO Namespace的名称必须是 avi-system
在这里插入图片描述

利用跳板机上传AKO Image

AKO的Image已经纳入了VMware官网,在Download页面已经提供下载链接,会转到AVI的下载页面,然后选择Additional Tools
在这里插入图片描述
下载1.3.1版本,得到一个ako-1.3.3.tar.gz文件。

[root@localhost avi]# tar -zxvf ako-1.3.1.tar.gz
ako/
ako/install_docs.txt
ako/ako-1.3.1-docker.tar.gz
ako/ako-1.3.1-helm.tgz
[root@localhost avi]# ls
ako  ako-1.3.1.tar.gz 

解压得到的install_docs.txt文本中有详细的教程在K8S上面安装AKO,我们利用里面提到的方法把AKO传到Harbor(关于证书的绑定,参考vSphere with K8S下使用Harbor)。

[root@localhost ako]# docker load < ako-1.3.1-docker.tar.gz
05c8ed526383: Loading layer [==================================================>]  37.12MB/37.12MB
7fccecfdb5e3: Loading layer [==================================================>]    136MB/136MB
f1ceba676801: Loading layer [==================================================>]  48.75MB/48.75MB
82e053fb2a7b: Loading layer [==================================================>]  3.072kB/3.072kB
Loaded image: projects.registry.vmware.com/ako/ako:1.3.1
[root@localhost ako]# docker images
REPOSITORY                             TAG       IMAGE ID       CREATED       SIZE
nginx                                  latest    6084105296a9   10 days ago   133MB
alpine/helm                            latest    131986ce5774   11 days ago   46MB
projects.registry.vmware.com/ako/ako   1.3.1     d4f6d9a876ec   2 weeks ago   221MB
[root@localhost ako]# docker tag projects.registry.vmware.com/ako/ako:1.3.1 10.105.130.197/avi-system/ako:1.3.1
[root@localhost ako]# docker push 10.105.130.197/avi-system/ako:1.3.1
The push refers to repository [10.105.130.197/avi-system/ako]
82e053fb2a7b: Pushed
f1ceba676801: Pushed
7fccecfdb5e3: Pushed
05c8ed526383: Pushed
1.3.1: digest: sha256:72333322a11e9dd4d2858fc99a50de1114d154b4b60170b822370f32b06963aa size: 1161

在这里插入图片描述
在这里插入图片描述

AVI Controller的配置

Edit Cloud

这里使用的Default-Cloud,在Datacenter中要勾选“Perfer Static Router vs Directly Connected Network"
在这里插入图片描述

为AKO增加静态地址池

当然,前提条件是在NSX-T上面把相关的LS逻辑交换机建好,如拓扑图,该LS链接到了T0。
在这里插入图片描述
这个地址池与SE Group所在的Segment关联,将给VS分配VIP。

在这里插入图片描述
在这里插入图片描述

为AKO修改IPAM

在这里插入图片描述

检查Cloud关联的IPAM

在这里插入图片描述

为AKO设置Service Engine Group

在这里插入图片描述

设置SE部署在WCP集群上
在这里插入图片描述

为AKO 的SE 增加默认路由

在这里插入图片描述

登录Supervisor Control Plane安装AKO

取得Supervisor Cluster Master的Root密码

登录到vCenter-10.105.130.18,使用**/usr/lib/vmware-wcp/decryptK8Pwd.py**

root@vcsa-01a [ ~ ]# /usr/lib/vmware-wcp/decryptK8Pwd.py
Read key from file

Connected to PSQL

Cluster: domain-c8:32e918fc-7ce5-4a65-ac55-eb28dfbb219c
IP: 10.105.130.51
PWD: LVGlPnRRhwTKCkaceIyO/ugNef4mbj4GOy+UdTgjI0LtpVOp2++VMu5x5PsoRrIDRfQBQOQdZ+fOywa/R+dALECWnilU02Z5YpS8EqDm9eNzKjc94Tq/TerD4yVN6fZjeLvUgbYDBJVq0GC5URAel6TOXFHa3qPLtWaMhSNJKBQ=

这样就可以登录到Supervisor Control Plane:

[root@localhost avi]# ssh root@10.105.130.51
Password:
Last login: Mon Mar 22 06:33:51 2021 from 10.105.130.1
 11:19:01 up 15 days,  6:49,  1 user,  load average: 4.72, 3.08, 2.78
root@42064bd9bb42bc1a6821049c83d14674 [ ~ ]# ls
ako-1.3.1.tar.gz  get_helm.sh  helm-v3.5.3-linux-amd64.tar.gz

这里我们可以看到,/root目录下已经有了helm-v3.5.3-linux-amd64.tar.gz的安装文件,这是用过scp命令在跳板机传过来的。

Supervisor Control Plane安装Helm

AKO 1.3.1版本的安装要求helm > 3.0 CLI installed,Helm的最新为v3.5.3
官方安装文档

Binary Releases
Every release of Helm provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed.

Download your desired version
Unpack it (tar -zxvf helm-v3.0.0-linux-amd64.tar.gz)
Find the helm binary in the unpacked directory, and move it to its desired destination (mv linux-amd64/helm /usr/local/bin/helm)

Helm安装选择下载二进制文件方式:

root@42064bd9bb42bc1a6821049c83d14674 [ ~ ]# tar -zxvf helm-v3.5.3-linux-amd64.tar.gz
linux-amd64/
linux-amd64/helm
linux-amd64/LICENSE
linux-amd64/README.md
root@42064bd9bb42bc1a6821049c83d14674 [ ~ ]# ls
ako-1.3.1.tar.gz  get_helm.sh  helm-v3.5.3-linux-amd64.tar.gz  linux-amd64
root@42064bd9bb42bc1a6821049c83d14674 [ ~ ]# mv linux-amd64/helm /usr/local/bin/helm
root@42064bd9bb42bc1a6821049c83d14674 [ ~ ]# helm version
version.BuildInfo{Version:"v3.5.3", GitCommit:"041ce5a2c17a58be0fcd5f5e16fb3e7e95fea622", GitTreeState:"dirty", GoVersion:"go1.15.8"}
其他参数准备
修改statefulset.yaml

解压ako-1.3.1.tar.gz

tar -zxvf ako-1.3.1.tar.gz
    ako/
    ako/install_docs.txt
    ako/ako-1.3.1-docker.tar.gz
    ako/ako-1.3.1-helm.tgz

继续解压 ako/ako-1.3.1-helm.tgz

root@42064bd9bb42bc1a6821049c83d14674 [ ~/ako/ako ]# ls
Chart.yaml  crds  templates  values.yaml
root@42064bd9bb42bc1a6821049c83d14674 [ ~/ako/ako ]# ls ./templates/
clusterrolebinding.yaml  clusterrole.yaml  configmap.yaml  _helpers.tpl  ingressclass.yaml  NOTES.txt  psppolicy.yaml  secret.yaml  serviceaccount.yaml  statefulset.yaml  tests

修改ako/templates/statefulset.yaml (第21行)
在这里插入图片描述

获取Namespace avi-system的Image pull secret名字
root@42064bd9bb42bc1a6821049c83d14674 [ ~/ako ]# kubectl get secrets -n avi-system
NAME                                   TYPE                                  DATA   AGE
ako-sa-token-jb2gb                     kubernetes.io/service-account-token   3      40h
avi-secret                             Opaque                                2      40h
avi-system-default-image-pull-secret   kubernetes.io/dockerconfigjson        1      3d16h
avi-system-default-image-push-secret   kubernetes.io/dockerconfigjson        1      3d16h
default-token-ngfzw                    kubernetes.io/service-account-token   3      3d17h
sh.helm.release.v1.ako.v1              helm.sh/release.v1                    1      40h

得到Pull secret的名字为:avi-system-default-image-pull-secret

使用Helm install安装AKO

helm install ako ./ako --version 1.3.1 \ #指定目录和版本,本例目录是解压 ako/ako-1.3.1-helm.tgz得到的./ako上一级
–set ControllerSettings.controllerHost=10.105.130.55 \ #AVI controller的地址
–set avicredentials.username=admin \ #AVI controller的管理用户名和密码(下一行)
–set avicredentials.password=VMware1!
–set ControllerSettings.controllerVersion=“20.1.3” \ #AVI的版本
–set AKOSettings.clusterName=Cluster-01 \ #AKO的作用集群,与AVI se group一致
–set NetworkSettings.subnetIP=172.100.0.0 \ #VIP/SE Group的地址段
–set NetworkSettings.subnetPrefix=24
–set NetworkSettings.networkName=ls-wcp-avi \ # 分段名(NSX-T)
–set AKOSettings.disableStaticRouteSync=true
–set image.repository=“10.105.130.197/avi-system/ako” \ # 私有仓库的AKO Image 地址
–set ControllerSettings.serviceEngineGroupName=“wcp-seg” \ # SE Group 名字
–set imagePullSecrets=“avi-system-default-image-pull-secret” \ #上面得到的Pull Secret名字
–set L7Settings.shardVSSize=SMALL --namespace=avi-system # 大小及Namespace

执行情况:

root@42064bd9bb42bc1a6821049c83d14674 [ ~/ako/ako ]# helm install ako . --version 1.3.1 --set ControllerSettings.controllerHost=10.105.130.55 --set avicredentials.username=admin --set avicredentials.password=VMware1! --set ControllerSettings.controllerVersion="20.1.3" --set AKOSettings.clusterName=Cluster-01 --set NetworkSettings.subnetIP=172.100.0.0 --set NetworkSettings.subnetPrefix=24 --set NetworkSettings.networkName=ls-wcp-avi --set AKOSettings.disableStaticRouteSync=true --set image.repository="10.105.130.197/avi-system/ako" --set ControllerSettings.serviceEngineGroupName="wcp-seg" --set imagePullSecrets="avi-system-default-image-pull-secret" --set L7Settings.shardVSSize=SMALL --namespace=avi-system
NAME: ako
LAST DEPLOYED: Mon Mar 22 12:44:23 2021
NAMESPACE: avi-system
STATUS: deployed
REVISION: 1

安装成功。

效果

从AVI的监控面板上面可以看的LB的工作已经由AVI接管

在这里插入图片描述

小结

  • WCP和AVI融合可以工作,AVI为Tanzu提供更为高性能高弹性的LB服务
  • 配置过程比较复杂,参数修改等方式挺原始的。有点像WCP测试版本的样子,当时还要登录Exsi修改参数
  • 估计后续随着AVI和NSX-T的结合,配置方式将大为简化
  • 现在毕竟是第一个版本,如果不是项目需要,不建议折腾。

以上

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐