本文将讨论VMware Tanzu应用平台的安装,以及用传输层安全(TLS)和Microsoft Windows Azure Active Directory(Azure AD)来保护用户界面。但首先,什么是Tanzu应用平台?
VMware Tanzu应用平台是一个模块化的应用感知平台,它提供了一套丰富的开发人员工具和预先铺设的生产路径。此外,它还允许开发人员在任何符合要求的公有云或企业内部的Kubernetes集群上快速、安全地构建和部署软件。
下面是一张很好的图表,说明Tanzu应用平台在概念上是什么。
安装Tanzu应用平台是非常简单的,但仍有一些问题,这篇文章将帮助你解决。
- 首先,请看一下先决条件。
- 你还需要访问VMware Tanzu网络。
- 从Tanzu网络,为你的操作系统下载Tanzu命令行界面(CLI),然后将其解包。
- 接下来,你将需要在这里下载Cluster Essentials for VMware Tanzu。
- 请确保你已经接受了所有适用的EULA。
- 你还需要一个域名,并为Tanzu应用平台划出一个子域名。请注意,注册表是必需的--下面的所有例子都会用到Harbor。
说了这么多,让我们开始设置一些有用的出口。
export INSTALL_BUNDLE=registry.tanzu.vmware.com/tanzu-cluster-essentials/cluster-essentials-bundle@sha256:ab0a3539da241a6ea59c75c0743e9058511d7c56312ea3906178ec0f3491f51d
export INSTALL_REGISTRY_HOSTNAME=registry.tanzu.vmware.com
export INSTALL_REGISTRY_USERNAME=TANZU-NET-USER
export INSTALL_REGISTRY_PASSWORD=TANZU-NET-PASSWORD
export TAP_VERSION=1.1.0
请注意,上面的INSTALL_BUNDLE 是针对Tanzu Application Platform 1.1.x的。如果你试图安装比这个版本更早的东西,你将需要通过Tanzu Application Platform文档来获得正确的INSTALL_BUNDLE 。
创建一个命名空间来安装Tanzu Application Platform。
kubectl create ns tap-install
现在你需要cd到你解开Tanzu Cluster Essentials的目录中。
cd $HOME/tanzu-cluster-essentials ## Or wherever you have cluster-essentials untarred
运行安装程序脚本。
./install.sh --yes
如果一切顺利完成,你就可以继续将kapp复制到我们的路径中。
sudo cp $HOME/tanzu-cluster-essentials/kapp /usr/local/bin/kapp ##Or wherever you have cluster-essentials untarred
接下来,安装Tanzu CLI。
export TANZU_CLI_NO_INIT=true
cd $HOME/tanzu # or wherever you downloaded the cli
install cli/core/VERSION/tanzu-core-darwin_amd64 /usr/local/bin/tanzu
请务必检查你的版本。
tanzu version
一旦确认了版本,完成插件的清洁安装。
tanzu plugin clean
cd $HOME/tanzu # again wherever you have downloaded this
tanzu plugin install --local cli all # make sure you are not in the cli directory when you do this go one directory above it
检查插件。
tanzu plugin list
你需要创建一个容器注册表秘密(即Docker注册表秘密)。
tanzu secret registry add tap-registry \
--username ${INSTALL_REGISTRY_USERNAME} --password ${INSTALL_REGISTRY_PASSWORD} \
--server ${INSTALL_REGISTRY_HOSTNAME} \
--export-to-all-namespaces --yes --namespace tap-install
通过运行Tanzu应用平台软件包库添加到集群中。
tanzu package repository add tanzu-tap-repository \
--url registry.tanzu.vmware.com/tanzu-application-platform/tap-packages:$TAP_VERSION \
--namespace tap-install
获取Tanzu应用平台软件包仓库的状态,并通过运行确保状态更新为 "recordcile "成功。
tanzu package repository get tanzu-tap-repository --namespace tap-install
接下来,你需要创建一个Tanzu Application Platform数值文件。下面是几个简单的选项,但还是那句话,我们的最终目标是在最终安装中拥有TLS和Azure AD。
下面是一个标准的Tanzu Application Platform数值文件的例子。
profile: full
ceip_policy_disclosed: true # Installation fails if this is set to 'false'
buildservice:
kp_default_repository: myharbor.com/tap/build-service
kp_default_repository_username: YOUR_REGISTRY_USER
kp_default_repository_password: YOUR_REGISTRY_PASSWORD
tanzunet_username: YOUR_TANZU_USERNAME
tanzunet_password: YOUR_TANZU_PASSWORD
descriptor_name: "full"
enable_automatic_dependency_updates: true
supply_chain: basic
cnrs:
domain_name: tap.alexanderbrash.dev
domain_template: "{{.Name}}-{{.Namespace}}.{{.Domain}}"
ootb_supply_chain_basic:
registry:
server: myharbor.com
repository: "tap/supply-chain"
gitops:
ssh_secret: ""
learningcenter:
ingressDomain: "learningcenter.tap.alexanderbrash.dev"
tap_gui:
service_type: ClusterIP
ingressEnabled: "true"
ingressDomain: "tap.alexanderbrash.dev"
app_config:
app:
baseUrl: http://tap-gui.tap.alexanderbrash.dev #Note this must be called tap-gui I tried tap-ui and it did not work
catalog:
locations:
- type: url
target: https://github.com/badraoul/tap-test/blob/main/blank/catalog-info.yaml
backend:
baseUrl: http://tap-gui.tap.alexanderbrash.dev #Note this must be called tap-gui I tried tap-ui and it did not work
cors:
origin: http://tap-gui.tap.alexanderbrash.dev #Note this must be called tap-gui I tried tap-ui and it did not work
metadata_store:
app_service_type: LoadBalancer # (optional) Defaults to LoadBalancer. Change to NodePort for distributions that don't support LoadBalancer
grype:
namespace: "default" # (optional) Defaults to default namespace.
targetImagePullSecret: "tap-registry"
contour:
envoy:
service:
type: LoadBalancer
下面是一个利用Amazon Web Services网络负载平衡器(AWS NLB)的例子。
profile: full
ceip_policy_disclosed: true # Installation fails if this is set to 'false'
buildservice:
kp_default_repository: myharbor.com/tap/build-service
kp_default_repository_username: HARBOR_USER
kp_default_repository_password: HARBOR_PASSWORD
tanzunet_username: TANZU_NET_USER
tanzunet_password: TANZU_NET_PASSWORD
descriptor_name: "tap-1.0.0-full"
enable_automatic_dependency_updates: true
supply_chain: basic
cnrs:
domain_name: alexanderbrash.dev
ootb_supply_chain_basic:
registry:
server: myharbor.com
repository: "tap/supply-chain"
gitops:
ssh_secret: ""
learningcenter:
ingressDomain: "lab.alexanderbrash.dev"
tap_gui:
service_type: ClusterIP
ingressEnabled: "true"
ingressDomain: "alexanderbrash.dev"
app_config:
app:
baseUrl: http://tap-gui.alexanderbrash.dev
catalog:
locations:
- type: url
target: https://github.com/badraoul/tap-test/blob/main/blank/catalog-info.yaml
backend:
baseUrl: http://tap-gui.alexanderbrash.dev
cors:
origin: http://tap-gui.alexanderbrash.dev
metadata_store:
app_service_type: LoadBalancer # (optional) Defaults to LoadBalancer. Change to NodePort for distributions that don't support LoadBalancer
grype:
namespace: "default" # (optional) Defaults to default namespace.
targetImagePullSecret: "tap-registry"
contour:
infrastructure_provider: aws
envoy:
service:
aws:
LBType: nlb
下面是期望的结果和使用TLS的例子。
profile: full
ceip_policy_disclosed: true # Installation fails if this is set to 'false'
buildservice:
kp_default_repository: myharbor.com/tap/build-service
kp_default_repository_username: HARBOR_USER
kp_default_repository_password: HARBOR_PASSWORD
tanzunet_username: TANZU_NET_USER
tanzunet_password: TANZU_NET_PASSWORD
descriptor_name: "full"
enable_automatic_dependency_updates: true
supply_chain: basic
cnrs:
domain_name: tap-lab.alexanderbrash.net
domain_template: "{{.Name}}-{{.Namespace}}.{{.Domain}}"
default_tls_secret: tls-certs/tap-lab-alexbrash-net-wldcrd
ootb_supply_chain_basic:
registry:
server: myharbor.com
repository: "tap/supply-chain"
gitops:
ssh_secret: ""
learningcenter:
ingressDomain: "learningcenter.tap-lab.alexanderbrash.net"
tap_gui:
service_type: ClusterIP
ingressEnabled: "true"
ingressDomain: "tap-lab.alexanderbrash.net"
tls:
secretName: tap-lab-alexbrash-net-wldcrd
namespace: tls-certs
app_config:
app:
baseUrl: https://tap-gui.tap-lab.alexanderbrash.net
catalog:
locations:
- type: url
target: https://github.com/badraoul/tap-test/blob/main/blank/catalog-info.yaml
backend:
baseUrl: https://tap-gui.tap-lab.alexanderbrash.net
cors:
origin: https://tap-gui.tap-lab.alexanderbrash.net
metadata_store:
app_service_type: LoadBalancer # (optional) Defaults to LoadBalancer. Change to NodePort for distributions that don't support LoadBalancer
grype:
namespace: "default" # (optional) Defaults to default namespace.
targetImagePullSecret: "tap-registry"
contour:
envoy:
service:
type: LoadBalancer
为了让TLS发挥作用,你需要为Envoy创建一个TLS委托,以及一个命名空间来保存TLS的秘密。
因此,首先,创建命名空间。
kubectl create ns tls-certs
接下来,建立TLS授权资源。
cat <<EOF > tls-delegation.yaml
apiVersion: projectcontour.io/v1
kind: TLSCertificateDelegation
metadata:
name: tap-lab-alexbrash-net-wldcrd
namespace: tls-certs
spec:
delegations:
- secretName: tap-lab-alexbrash-net-wldcrd
targetNamespaces:
- "*"
EOF
kubectl apply -f tls-delegation.yaml
现在,在TLS-certs命名空间中创建证书。
kubectl create secret tls tap-lab-alexbrash-net-wldcrd --key cert-key.pem --cert cert.pem -n tls-certs
之后,添加Azure AD。默认情况下,Tanzu应用平台GUI使用访客账户,但后台支持不同的认证提供者。
在Tanzu应用平台GUI中添加TLS的另一个原因是,它是启用认证的必要条件。
在Azure门户内,前往 "Azure Active Directory",然后在 "应用程序注册 "下点击 "新注册"。 从这里,只需给它一个名字,然后在 "支持的账户类型 "下选择适合你的组织的选项。(在这个例子中,选择了默认选项。)最后,在 "重定向URI "下选择 "网络 "作为平台。
接下来,输入以下统一资源标识符(URI)。
https://tap-gui.yourdomain/api/auth/microsoft/handler/frame
然后,你将需要创建一个客户秘密。在 "证书和秘密 "下选择 "新的客户秘密",并按照提示操作。请注意,你的客户秘密是 "值 "而不是秘密ID。(我犯了这个错误,并且正在排除为什么事情有一段时间不能工作的原因)。
对于值文件,你将需要以下三样东西。
- 客户端ID
- 租户ID
- 客户端秘密
你的值文件现在看起来像这样。
profile: full
ceip_policy_disclosed: true # Installation fails if this is set to 'false'
buildservice:
kp_default_repository: HARBOR_REGISTRY_URL/tap/build-service
kp_default_repository_username: HARBOR_USER
kp_default_repository_password: HARBOR_PASSWORD
tanzunet_username: TANZU_NET_USER
tanzunet_password: TANZU_NET_PASSWORD
descriptor_name: "full"
enable_automatic_dependency_updates: true
supply_chain: basic
cnrs:
domain_name: tap.alexanderbrash.dev
domain_template: "{{.Name}}-{{.Namespace}}.{{.Domain}}"
default_tls_secret: tls-certs/tap-alexbrash-dev-wildcard
ootb_supply_chain_basic:
registry:
server: HARBOR_REGISTRY_URL
repository: "tap/supply-chain"
gitops:
ssh_secret: ""
learningcenter:
ingressDomain: "learningcenter.tap.alexanderbrash.dev"
tap_gui:
service_type: ClusterIP
ingressEnabled: "true"
ingressDomain: "tap.alexanderbrash.dev"
tls:
secretName: tap-alexbrash-dev-wildcard
namespace: tls-certs
app_config:
auth:
allowGuestAccess: false
environment: development
providers:
microsoft:
development:
clientId: AZURE_CLIENTID
clientSecret: AZURE_CLIENT_SECRET
tenantId: AZURE_TENANTID
app:
baseUrl: https://tap-gui.tap.alexanderbrash.dev
catalog:
locations:
- type: url
target: https://github.com/badraoul/tap-test/blob/main/blank/catalog-info.yaml
backend:
baseUrl: https://tap-gui.tap.alexanderbrash.dev
cors:
origin: https://tap-gui.tap.alexanderbrash.dev
metadata_store:
app_service_type: LoadBalancer # (optional) Defaults to LoadBalancer. Change to NodePort for distributions that don't support LoadBalancer
grype:
namespace: "default" # (optional) Defaults to default namespace.
targetImagePullSecret: "tap-registry"
contour:
envoy:
service:
type: LoadBalancer
说完了这些,我们来安装Tanzu应用平台。
tanzu package install tap -p tap.tanzu.vmware.com -v $TAP_VERSION --values-file tap-values.yml -n tap-install
您将需要确保所有的软件包都调和成功。
tanzu package installed list -n tap-install
请注意:安装时间取决于你的集群中的可用资源。考虑到这一点,我建议至少有四个m5.x大型节点(即四个4vCPUs和16GB内存的节点,至少有70GB的磁盘空间)。
一个成功的调和看起来像下面的图片。
就这样--你现在已经有了Tanzu应用平台并开始运行了!