---
# System prepended metadata

title: TAP 安裝事前準備
tags: [tap]

---

# TAP 安裝事前準備
## 1. TAP CLI
1. Go to Tanzu Application Platform.
https://network.tanzu.vmware.com/products/tanzu-application-platform/
Download tanzu-core-cli-binaries/tanzu-core-cli-linux
2. 確認於工作叢集
```
kubectl config get-contexts
kubectl config use-context wld02-admin@wld02
```
3. 安裝工具(Bastion)
```
cd $HOME/tap
tar -xvf tanzu-framework-linux-amd64.tar -C $HOME/tap
sudo install v0.90.1/tanzu-cli-linux_amd64 /usr/local/bin/tanzu
tanzu version
```

4. 下載 bundle (Internet)
於有internet環境之工作機下載 bundle後, 送至 bastion 機中上傳至 harbor
```
tanzu plugin download-bundle --to-tar /tmp/tanzu-bundle.tar.gz
或者只下載 tap 相關 plugin
tanzu plugin download-bundle --group vmware-tap/default:v1.6.1 --to-tar /tmp/tap-plugin.tar.gz

tanzu plugin upload-bundle \
  --tar /tmp/tanzu-bundle.tar.gz \
  --to-repo harbor.tanzu.tim.lab/tanzu-cli/plugin
    
tanzu plugin source update default --uri harbor.tanzu.tim.lab/tanzu-cli/plugin/plugin-inventory:latest

tanzu plugin install --group vmware-tap/default:v1.6.1
```
![](https://hackmd.io/_uploads/BJ2lHRX3n.png)

## TAP Image
1. 設定環境變數
```
# Set tanzunet as the source registry to copy the Tanzu Application Platform packages from.
export IMGPKG_REGISTRY_HOSTNAME_0=registry.tanzu.vmware.com
export IMGPKG_REGISTRY_USERNAME_0=yunw1@vmware.com
export IMGPKG_REGISTRY_PASSWORD_0=Wfsh471128@2023q1

# The user’s registry for copying the Tanzu Application Platform package to.
export IMGPKG_REGISTRY_HOSTNAME_1=harbor.tanzu.tim.lab/tap
export IMGPKG_REGISTRY_USERNAME_1=admin
export IMGPKG_REGISTRY_PASSWORD_1=VMware1\!PSO
export TAP_VERSION=1.6.3-rc.5
export TBS_VERSION=1.6.3-rc.5
export REGISTRY_CA_PATH=~/harbor/ca/ca.crt
```
2. 下載
```
imgpkg copy \
  -b registry.tanzu.vmware.com/tanzu-application-platform/tap-packages:$TAP_VERSION \
  --to-tar tap-packages-$TAP_VERSION.tar \
  --include-non-distributable-layers

imgpkg copy \
  -b registry.tanzu.vmware.com/tanzu-application-platform/full-deps-package-repo:$TBS_VERSION \
  --to-tar=tbs-full-deps.tar
```
3. 上傳
```
imgpkg copy \
  --tar tap-packages-$TAP_VERSION.tar \
  --to-repo $IMGPKG_REGISTRY_HOSTNAME_1/tap-packages \
  --include-non-distributable-layers \
  --registry-ca-cert-path $REGISTRY_CA_PATH
  
imgpkg copy \
  --tar tbs-full-deps.tar \
  --to-repo=$IMGPKG_REGISTRY_HOSTNAME_1/tap-packages/tbs-full-deps \
  --include-non-distributable-layers \
  --registry-ca-cert-path $REGISTRY_CA_PATH
```

## 設定安裝環境
1. 建立 tap 安裝 namespace
```
kubectl create ns tap-install
```
2. 建立 tap 存取 image 之 secret
* 安裝產品所需 **tap-registry**
```
tanzu secret registry add tap-registry \
    --server   $IMGPKG_REGISTRY_HOSTNAME_1 \
    --username $IMGPKG_REGISTRY_USERNAME_1 \
    --password $IMGPKG_REGISTRY_PASSWORD_1 \
    --namespace tap-install \
    --export-to-all-namespaces \
    --yes
```
* workload build image 時會放置於 tap-ap，因此要使用 global，不要使用 project based. 所需 **registry-credentials**
```
tanzu secret registry add registry-credentials \
    --server   harbor.tanzu.tim.lab \
    --username $IMGPKG_REGISTRY_USERNAME_1 \
    --password $IMGPKG_REGISTRY_PASSWORD_1 \
    --namespace tap-install \
    --export-to-all-namespaces \
    --yes
```
3. 將 tap repo 安裝至 tap-install
```
tanzu package repository add tanzu-tap-repository \
  --url $IMGPKG_REGISTRY_HOSTNAME_1/tap-packages:$TAP_VERSION \
  --namespace tap-install

tanzu package available list --namespace tap-install
```