IK.AM

@making's tech note


Tanzu Application Platform 0.4 (Beta-4) をTanzu Kubernetes Gridにインストールし"Source to URL"を試すメモ

🗃 {Dev/CaaS/Kubernetes/TAP}
🏷 Kubernetes 🏷 Cartographer 🏷 TKG 🏷 Tanzu 🏷 TAP 🏷 Knative 
🗓 Updated at 2022-01-11T17:54:25Z  🗓 Created at 2021-12-26T13:09:12Z   🌎 English Page

⚠️ 本記事の内容はVMwareによってサポートされていません。 記事の内容で生じた問題については自己責任で対応し、 VMwareサポート窓口には問い合わせないでください

Tanzu Application Platform v0.4 (Beta-4) をTanzu Kubernetes Grid 1.4にインストールします。

TAPはKubernetes上でCloud FoundryやHerokuのようなDeveloper Experienceを提供するPlatformです。

本記事ではTAPをInstallし、"Hello World"なアプリケーションをソースコードからデプロイする機能("Source to URL")を試します。

目次

プラグインのインストール

tanzu CLIはTAPからも配布されていますが、TKG用のものを使用します。

$ tanzu version
version: v1.4.0
buildDate: 2021-08-30
sha: c9929b8f

こちらのドキュメント にしたがって、既存の tanzu CLIにプラグインを追加します。

プラグインは こちら からダウンロードできますが、ここでは pivnet CLIを使用してダウンロードします。 pivnet CLIはbrewでインストールできます。

brew install pivotal/tap/pivnet-cli

VMware Tanzu Network のAPI Tokenを取得して、pivnet CLIでログインします。

pivnet login --api-token=<API Token>

プラグインをダウンロードします

# Macの場合
pivnet download-product-files --product-slug='tanzu-application-platform' --release-version='0.4.0' --product-file-id=1100107

# Linuxの場合
pivnet download-product-files --product-slug='tanzu-application-platform' --release-version='0.4.0' --product-file-id=1100110

# Windowsの場合
pivnet download-product-files --product-slug='tanzu-application-platform' --release-version='0.4.0' --product-file-id=1100111

Macの場合の手順をメモします。

mkdir $HOME/tanzu
tar -xvf tanzu-framework-darwin-amd64.tar -C $HOME/tanzu
cd $HOME/tanzu

export TANZU_CLI_NO_INIT=true

# 古いプラグインがあれば削除
tanzu plugin delete imagepullsecret
tanzu plugin delete package

# TAP用のプラグインを追加
tanzu plugin install secret --local ./cli
tanzu plugin install accelerator --local ./cli
tanzu plugin install apps --local ./cli
tanzu plugin install package --local ./cli
tanzu plugin install services --local ./cli

プラグイン一覧が次のようになればOKです。

$ tanzu plugin list
  NAME                LATEST VERSION  DESCRIPTION                                                        REPOSITORY  VERSION  STATUS             
  accelerator                         Manage accelerators in a Kubernetes cluster                                    v0.5.0   installed          
  alpha               v1.4.0          Alpha CLI commands                                                 core                 not installed      
  apps                                Applications on Kubernetes                                                     v0.4.0   installed          
  cluster             v1.4.0          Kubernetes cluster operations                                      core        v1.4.0   installed          
  kubernetes-release  v1.4.0          Kubernetes release operations                                      core        v1.4.0   installed          
  login               v1.4.0          Login to the platform                                              core        v1.4.0   installed          
  management-cluster  v1.4.0          Kubernetes management cluster operations                           core        v1.4.0   installed          
  package             v1.4.0          Tanzu package management                                           core        v0.12.0  upgrade available  
  pinniped-auth       v1.4.0          Pinniped authentication operations (usually not directly invoked)  core        v1.4.0   installed          
  secret                              Tanzu secret management                                                        v0.12.0  installed          
  services                            Discover Service Types and manage Service Instances (ALPHA)                    v0.1.0   installed 

事前準備

TAPをインストールする前にインストールが必要なコンポーネントをインストールします。

kapp-controllerのアップデート

TAP 0.4はkapp-controllerのバージョンが0.29以上である必要があります。TKG 1.4に含まれるkapp controllerはバージョンが0.23なので、kapp-controllerを手動で入れ替えます。

TKGのWorkload Clusterのkapp controllerはManagement Clusterのkapp-controller(App CR)によってインストールされているので、手動の変更がreconciliation loopによって戻されないように、 Management Cluster側のApp CRにpauseの設定を行います。

kubectl patch --context <MANAGEMENT_CLUSTER>-admin@<MANAGEMENT_CLUSTER> app/<WORKLOAD-CLUSTER>-kapp-controller -n default -p '{"spec":{"paused":true}}' --type=merge

Workload Clusterのkapp controllerを削除し、新しいkapp controllerをインストールします。

kubectl delete deployment kapp-controller -n tkg-system
kubectl apply -f https://github.com/vmware-tanzu/carvel-kapp-controller/releases/download/v0.29.0/release.yml

secretgen-controllerのインストール

TAPのインストール時にSecretを他のnamespaceにexportするために secretgen-controller が使用されます。

kubectl create ns secretgen-controller
kubectl apply -f https://github.com/vmware-tanzu/carvel-secretgen-controller/releases/latest/download/release.yml

EULAの承諾

初回はTAPで使用するコンポーネントのEULA (End User License Agreement)を承諾する必要があります。 Webブラウザから承諾しても良いですが、楽をしたい場合は次のコマンドでもまとめて承諾できます。 必要十分な量かわかりません。多分余分なので少し時間がかかります。

for p in $(pivnet products | grep 'tanzu-.*-buildpack' | awk '{print $4}');do
  echo $p
  pivnet curl -X POST $(pivnet releases -p ${p} --format=json | jq -r '.[0]._links.eula_acceptance.href')
  echo
done
for p in $(pivnet products | grep 'tanzu-.*-stack' | awk '{print $4}');do
  echo $p
  pivnet curl -X POST $(pivnet releases -p ${p} --format=json | jq -r '.[0]._links.eula_acceptance.href')
  echo
done
for p in build-service tbs-dependencies tanzu-application-platform api-portal;do
  echo $p
  pivnet curl -X POST $(pivnet releases -p ${p} --format=json | jq -r '.[0]._links.eula_acceptance.href')
  echo
done

TAPのインストール

TAPは Carvel Package としてOCIイメージで配布されています。 このOCIレジストリにアクセスするためのSecretを tap-install namespaceに作成します。

TANZUNET_USERNAME=...
TANZUNET_PASSWORD=...

kubectl create ns tap-install
tanzu secret registry add tap-registry \
  --username "$TANZUNET_USERNAME" --password "$TANZUNET_PASSWORD" \
  --server registry.tanzu.vmware.com \
  --export-to-all-namespaces --yes --namespace tap-install

TAPのpackage repositoryを登録します。

tanzu package repository add tanzu-tap-repository \
  --url registry.tanzu.vmware.com/tanzu-application-platform/tap-packages:0.4.0 \
  --namespace tap-install

利用可能なパッケージが次のように出力されればOKです。registryの登録からpacakgeの情報を取得するのに少し時間がかかるので、登録直後は何も出力されないかもしれません。

$ tanzu package available list --namespace tap-install
| Retrieving available packages... 
  NAME                                                 DISPLAY-NAME                                                              SHORT-DESCRIPTION                                                                                                                                              LATEST-VERSION  
  accelerator.apps.tanzu.vmware.com                    Application Accelerator for VMware Tanzu                                  Used to create new projects and configurations.                                                                                                                0.5.1           
  api-portal.tanzu.vmware.com                          API portal                                                                A unified user interface to enable search, discovery and try-out of API endpoints at ease.                                                                     1.0.6           
  build.appliveview.tanzu.vmware.com                   Application Live View Conventions for VMware Tanzu                        Application Live View convention server                                                                                                                        1.0.0           
  buildservice.tanzu.vmware.com                        Tanzu Build Service                                                       Tanzu Build Service enables the building and automation of containerized software workflows securely and at scale.                                             1.4.0-build.1   
  cartographer.tanzu.vmware.com                        Cartographer                                                              Kubernetes native Supply Chain Choreographer.                                                                                                                  0.0.8-rc.7      
  cnrs.tanzu.vmware.com                                Cloud Native Runtimes                                                     Cloud Native Runtimes is a serverless runtime based on Knative                                                                                                 1.1.0           
  controller.conventions.apps.tanzu.vmware.com         Convention Service for VMware Tanzu                                       Convention Service enables app operators to consistently apply desired runtime configurations to fleets of workloads.                                          0.4.2           
  controller.source.apps.tanzu.vmware.com              Tanzu Source Controller                                                   Tanzu Source Controller enables workload create/update from source code.                                                                                       0.2.0           
  developer-conventions.tanzu.vmware.com               Tanzu App Platform Developer Conventions                                  Developer Conventions                                                                                                                                          0.4.0-build1    
  fluxcd.source.controller.tanzu.vmware.com            Flux Source Controller                                                    The source-controller is a Kubernetes operator, specialised in artifacts acquisition from external sources such as Git, Helm repositories and S3 buckets.      0.16.0          
  image-policy-webhook.signing.run.tanzu.vmware.com    Image Policy Webhook                                                      Image Policy Webhook enables defining of a policy to restrict unsigned container images.                                                                       1.0.0-beta.2    
  learningcenter.tanzu.vmware.com                      Learning Center for Tanzu Application Platform                            Guided technical workshops                                                                                                                                     0.1.0-build.6   
  ootb-delivery-basic.tanzu.vmware.com                 Tanzu App Platform Out of The Box Delivery Basic                          Out of The Box Delivery Basic.                                                                                                                                 0.4.0-build.2   
  ootb-supply-chain-basic.tanzu.vmware.com             Tanzu App Platform Out of The Box Supply Chain Basic                      Out of The Box Supply Chain Basic.                                                                                                                             0.4.0-build.2   
  ootb-supply-chain-testing-scanning.tanzu.vmware.com  Tanzu App Platform Out of The Box Supply Chain with Testing and Scanning  Out of The Box Supply Chain with Testing and Scanning.                                                                                                         0.4.0-build.2   
  ootb-supply-chain-testing.tanzu.vmware.com           Tanzu App Platform Out of The Box Supply Chain with Testing               Out of The Box Supply Chain with Testing.                                                                                                                      0.4.0-build.2   
  ootb-templates.tanzu.vmware.com                      Tanzu App Platform Out of The Box Templates                               Out of The Box Templates.                                                                                                                                      0.4.0-build.2   
  run.appliveview.tanzu.vmware.com                     Application Live View for VMware Tanzu                                    App for monitoring and troubleshooting running apps                                                                                                            1.0.0           
  scst-grype.apps.tanzu.vmware.com                     Grype for Supply Chain Security Tools - Scan                              Default scan templates using Anchore Grype                                                                                                                     1.0.0           
  scst-scan.apps.tanzu.vmware.com                      Supply Chain Security Tools - Scan                                        Scan for vulnerabilities and enforce policies directly within Kubernetes native Supply Chains.                                                                 1.0.0           
  scst-store.tanzu.vmware.com                          Supply Chain Security Tools - Store                                       Post SBoMs and query for image, package, and vulnerability metadata.                                                                                           1.0.0-beta.2    
  service-bindings.labs.vmware.com                     Service Bindings for Kubernetes                                           Service Bindings for Kubernetes implements the Service Binding Specification.                                                                                  0.6.0           
  services-toolkit.tanzu.vmware.com                    Services Toolkit                                                          The Services Toolkit enables the management, lifecycle, discoverability and connectivity of Service Resources (databases, message queues, DNS records, etc.).  0.5.0-rc.3      
  spring-boot-conventions.tanzu.vmware.com             Tanzu Spring Boot Conventions Server                                      Default Spring Boot convention server.                                                                                                                         0.2.0           
  tap-gui.tanzu.vmware.com                             Tanzu Application Platform GUI                                            web app graphical user interface for Tanzu Application Platform                                                                                                1.0.0-rc.72     
  tap-telemetry.tanzu.vmware.com                       Telemetry Collector for Tanzu Application Platform                        Tanzu Application Plaform Telemetry                                                                                                                            0.1.1           
  tap.tanzu.vmware.com                                 Tanzu Application Platform                                                Package to install a set of TAP components to get you started based on your use case.                                                                          0.4.0           
  tekton.tanzu.vmware.com                              Tekton Pipelines                                                          Tekton Pipelines is a framework for creating CI/CD systems.                                                                                                    0.40.0          
  workshops.learningcenter.tanzu.vmware.com            Workshop Building Tutorial                                                Workshop Building Tutorial                                                                                                                                     0.1.0-build.7   

Packageの仕組みは Tanzu Community Edition のドキュメントが詳しいです

TAPは複数のコンポーネントから構成されており、必要に応じて取捨選択できます。ただし個別で全てのコンポーネントをインストールするのは面倒くさいので、 よく使うものをパッケージングした Profile が用意されています。0.4ではFull (full)とDev (dev)の二つのProfileが用意されています。

今回はDev Profileを使用します。このProfileをインストールするのに次の tap-values.yaml に設定を記述します。 ここではTAPではソースコードをコンテナイメージに変換する際にTBS (Tanzu Build Service)を使用しますが、ここではTBSがpushするコンテナレジストリにghcr.ioを利用します。

GITHUB_USERNAME=...
GITHUB_API_TOKEN=...

cat <<EOF > tap-values.yaml
profile: dev
ceip_policy_disclosed: true
buildservice:
  kp_default_repository: ghcr.io/${GITHUB_USERNAME}/build-service
  kp_default_repository_username: ${GITHUB_USERNAME}
  kp_default_repository_password: ${GITHUB_API_TOKEN}
  tanzunet_username: ${TANZUNET_USERNAME}
  tanzunet_password: ${TANZUNET_PASSWORD}

cnrs:
  domain_name: leopard.maki.lol

contour:
  envoy:
    service:
      type: LoadBalancer

supply_chain: basic

ootb_supply_chain_basic:
  registry:
    server: ghcr.io
    repository: ${GITHUB_USERNAME}

learningcenter:
  ingressDomain: learningcenter.leopard.maki.lol

tap_gui:
  service_type: LoadBalancer

metadata_store:
  app_service_type: LoadBalancer  
EOF

設定可能な値は次のコマンドで確認できます。

tanzu package available get tap.tanzu.vmware.com/0.4.0 --values-schema --namespace tap-install

なお、Profileは"packageをインストールしたpackage"です。tap.tanzu.vmware.com/0.4.0 の設定一覧には個別のpackageの設定項目は出力されないため、 例えば、tap-values.yamlootb_supply_chain_basic prefixな設定項目を確認したい場合は、次のように ootb-supply-chain-basic.tanzu.vmware.com/0.4.0-build.5 の設定項目を見れば良いです。

$ tanzu package available get ootb-supply-chain-basic.tanzu.vmware.com/0.4.0-build.5 --values-schema --namespace tap-install
| Retrieving package details for ootb-supply-chain-basic.tanzu.vmware.com/0.4.0-build.5...
KEY                  DEFAULT          TYPE    DESCRIPTION                                                                                                                                                                                                  
cluster_builder      default          string  Name of the Tanzu Build Service (TBS) ClusterBuilder to use by default on image objects managed by the supply chain.                                                                                         
registry.repository  <nil>            string  Name of the repository in the image registry server where the application images from the workloads should be pushed to (required).                                                                          
registry.server      index.docker.io  string  Name of the registry server where application images should be pushed to (required).                                                                                                                         
service_account      default          string  Name of the service account in the namespace where the Workload is submitted to utilize for providing registry credentials to Tanzu Build Service (TBS) Image objects as well as deploying the application.

次のコマンドでインストールします。

tanzu package install tap -p tap.tanzu.vmware.com -v 0.4.0 --values-file tap-values.yaml -n tap-install

Packageによってkapp-controllerのApp CRがコンポーネントごとできます。各コンポーネントのインストールの進捗は次のコマンドでの DESCRIPTION で確認できます。 Reconciling になっているものはインストール中です。 Reconcile succeeded になればインストール成功です。

$ kubectl get app -n tap-install
NAME                       DESCRIPTION   SINCE-DEPLOY   AGE
buildservice               Reconciling                  18s
cert-manager               Reconciling   7s             20s
fluxcd-source-controller   Reconciling   4s             20s
service-bindings           Reconciling                  19s
services-toolkit           Reconciling   6s             20s
source-controller          Reconciling   6s             20s
tap                        Reconciling   21s            36s
tap-telemetry              Reconciling                  18s
tekton-pipelines           Reconciling   7s             19s

各コンポーネントのインストールの詳細は次のコマンドで確認できます。

kubectl get app -n tap-install <APP NAME> -oyaml

次のコマンドのインストール済みパッケージ一覧としても確認できます。

$ tanzu package installed list --namespace tap-install
\ Retrieving installed packages... 
  NAME                      PACKAGE-NAME                                  PACKAGE-VERSION  STATUS               
  accelerator               accelerator.apps.tanzu.vmware.com             0.5.1            Reconcile succeeded  
  appliveview               run.appliveview.tanzu.vmware.com              1.0.0            Reconcile succeeded  
  appliveview-conventions   build.appliveview.tanzu.vmware.com            1.0.0            Reconcile succeeded  
  buildservice              buildservice.tanzu.vmware.com                 1.4.0-build.1    Reconcile succeeded  
  cartographer              cartographer.tanzu.vmware.com                 0.0.8-rc.7       Reconcile succeeded  
  cert-manager              cert-manager.tanzu.vmware.com                 1.5.3+tap.1      Reconcile succeeded  
  cnrs                      cnrs.tanzu.vmware.com                         1.1.0            Reconcile succeeded  
  contour                   contour.tanzu.vmware.com                      1.18.2+tap.1     Reconcile succeeded  
  conventions-controller    controller.conventions.apps.tanzu.vmware.com  0.4.2            Reconcile succeeded  
  developer-conventions     developer-conventions.tanzu.vmware.com        0.4.0-build1     Reconcile succeeded  
  fluxcd-source-controller  fluxcd.source.controller.tanzu.vmware.com     0.16.0           Reconcile succeeded  
  ootb-delivery-basic       ootb-delivery-basic.tanzu.vmware.com          0.4.0-build.2    Reconcile succeeded  
  ootb-supply-chain-basic   ootb-supply-chain-basic.tanzu.vmware.com      0.4.0-build.2    Reconcile succeeded  
  ootb-templates            ootb-templates.tanzu.vmware.com               0.4.0-build.2    Reconcile succeeded  
  service-bindings          service-bindings.labs.vmware.com              0.6.0            Reconcile succeeded  
  services-toolkit          services-toolkit.tanzu.vmware.com             0.5.0-rc.3       Reconcile succeeded  
  source-controller         controller.source.apps.tanzu.vmware.com       0.2.0            Reconcile succeeded  
  spring-boot-conventions   spring-boot-conventions.tanzu.vmware.com      0.2.0            Reconcile succeeded  
  tap                       tap.tanzu.vmware.com                          0.4.0            Reconcile succeeded  
  tap-gui                   tap-gui.tanzu.vmware.com                      1.0.0-rc.72      Reconcile succeeded  
  tap-telemetry             tap-telemetry.tanzu.vmware.com                0.1.1            Reconcile succeeded  
  tekton-pipelines          tekton.tanzu.vmware.com                       0.40.0           Reconcile succeeded 

Developer Light Profileインストール後のPod一覧は次のようになります。

$ kubectl get pod -A
NAMESPACE                NAME                                                     READY   STATUS    RESTARTS   AGE
accelerator-system       acc-engine-f7b898fff-rrrjt                               1/1     Running   0          20m
accelerator-system       acc-server-d47df4c4b-gjprd                               1/1     Running   0          20m
accelerator-system       accelerator-controller-manager-578bc48c65-kq6z4          1/1     Running   0          20m
alv-convention           appliveview-webhook-d4b8fb9c7-mxq9w                      1/1     Running   0          16m
app-live-view            application-live-view-connector-5ccv9                    1/1     Running   0          21m
app-live-view            application-live-view-connector-ghskj                    1/1     Running   0          21m
app-live-view            application-live-view-connector-sfwc6                    1/1     Running   0          21m
app-live-view            application-live-view-server-6db78b4589-llkm5            1/1     Running   0          21m
avi-system               ako-0                                                    1/1     Running   0          122m
build-service            build-pod-image-fetcher-n8k5n                            5/5     Running   0          22m
build-service            build-pod-image-fetcher-nrsx8                            5/5     Running   0          22m
build-service            build-pod-image-fetcher-tkl9g                            5/5     Running   0          22m
build-service            cert-injection-webhook-68f7f4556f-49fpl                  1/1     Running   0          22m
build-service            dependency-updater-controller-698bcb95dc-7jll6           1/1     Running   0          22m
build-service            secret-syncer-controller-c5774f898-q98c5                 1/1     Running   0          22m
build-service            warmer-controller-7c57577dcf-smxdg                       1/1     Running   0          22m
cartographer-system      cartographer-controller-75678fd467-8l6cx                 1/1     Running   6          21m
cert-manager             cert-manager-6dc75bc658-pd6rs                            1/1     Running   0          19m
cert-manager             cert-manager-cainjector-67d96d9c7d-nxf7n                 1/1     Running   0          19m
cert-manager             cert-manager-webhook-75f6c498b9-qwvzk                    1/1     Running   0          19m
conventions-system       conventions-controller-manager-7d4694dbb-fjmx7           1/1     Running   0          21m
developer-conventions    webhook-78f46fc999-qjvj9                                 1/1     Running   0          15m
flux-system              source-controller-7cf9b776fb-sjgzw                       1/1     Running   0          23m
kapp-controller          kapp-controller-b8988c788-z8w4t                          1/1     Running   0          113m
knative-eventing         eventing-controller-7f8c84f8cd-d7pbc                     1/1     Running   0          20m
knative-eventing         eventing-webhook-84f85f9556-28ln9                        1/1     Running   0          19m
knative-eventing         eventing-webhook-84f85f9556-nb2p5                        1/1     Running   0          20m
knative-eventing         imc-controller-947498f94-ggj92                           1/1     Running   0          20m
knative-eventing         imc-dispatcher-56f976dcb6-5g7zh                          1/1     Running   0          20m
knative-eventing         mt-broker-controller-77bff55bc5-p9gmq                    1/1     Running   0          20m
knative-eventing         mt-broker-filter-77496c6485-zj8pm                        1/1     Running   0          20m
knative-eventing         mt-broker-ingress-b855d987b-894qc                        1/1     Running   0          20m
knative-eventing         rabbitmq-broker-controller-d495754d6-jml28               1/1     Running   0          20m
knative-eventing         rabbitmq-broker-webhook-68f7bb975-dqnht                  1/1     Running   0          20m
knative-eventing         sugar-controller-64b8b76bd6-mxsvx                        1/1     Running   0          20m
knative-serving          activator-6f8966fb67-b7bz6                               1/1     Running   1          20m
knative-serving          activator-6f8966fb67-csrrt                               1/1     Running   0          19m
knative-serving          activator-6f8966fb67-n76fx                               1/1     Running   0          19m
knative-serving          autoscaler-55f4bf5448-4lgd8                              1/1     Running   0          19m
knative-serving          autoscaler-hpa-6ddc568575-7w7gp                          1/1     Running   0          20m
knative-serving          controller-7cc5f84847-pmjbq                              1/1     Running   0          20m
knative-serving          domain-mapping-589fb6cb94-s5h8p                          1/1     Running   0          20m
knative-serving          domainmapping-webhook-ff764f99c-7wsht                    1/1     Running   0          20m
knative-serving          net-certmanager-controller-7cc6c79f6d-8tt6j              1/1     Running   0          20m
knative-serving          net-certmanager-webhook-7b548c9795-6hl9h                 1/1     Running   0          19m
knative-serving          net-contour-controller-7698bdb797-c95j7                  1/1     Running   0          20m
knative-serving          webhook-866888f8-6bg69                                   1/1     Running   0          19m
knative-serving          webhook-866888f8-nxhqh                                   1/1     Running   0          20m
knative-sources          rabbitmq-controller-manager-6c4b68488d-n62zh             1/1     Running   0          20m
knative-sources          rabbitmq-webhook-9c9ccf6bb-tp75r                         1/1     Running   0          20m
kpack                    kpack-controller-5d985578cb-6tjnk                        1/1     Running   0          22m
kpack                    kpack-webhook-78669fdf7b-wpz2t                           1/1     Running   0          22m
kube-system              antrea-agent-gltn4                                       2/2     Running   0          121m
kube-system              antrea-agent-n8rlr                                       2/2     Running   0          122m
kube-system              antrea-agent-qltkq                                       2/2     Running   0          121m
kube-system              antrea-agent-qrbw9                                       2/2     Running   0          121m
kube-system              antrea-controller-bd974f46f-dxvpx                        1/1     Running   0          122m
kube-system              coredns-8dcb5c56b-fjwgx                                  1/1     Running   0          124m
kube-system              coredns-8dcb5c56b-qfsqr                                  1/1     Running   0          124m
kube-system              etcd-leopard-control-plane-bz787                         1/1     Running   0          123m
kube-system              kube-apiserver-leopard-control-plane-bz787               1/1     Running   0          123m
kube-system              kube-controller-manager-leopard-control-plane-bz787      1/1     Running   0          123m
kube-system              kube-proxy-5b6xs                                         1/1     Running   0          121m
kube-system              kube-proxy-78nxd                                         1/1     Running   0          121m
kube-system              kube-proxy-95pbt                                         1/1     Running   0          124m
kube-system              kube-proxy-xh8b7                                         1/1     Running   0          121m
kube-system              kube-scheduler-leopard-control-plane-bz787               1/1     Running   0          123m
kube-system              metrics-server-88669f597-ghw8k                           1/1     Running   0          122m
kube-system              vsphere-cloud-controller-manager-g7fxw                   1/1     Running   0          122m
kube-system              vsphere-csi-controller-6cfcbf5f8-ncmvk                   6/6     Running   20         121m
kube-system              vsphere-csi-node-27w9f                                   3/3     Running   7          121m
kube-system              vsphere-csi-node-986qr                                   3/3     Running   0          121m
kube-system              vsphere-csi-node-hfqqk                                   3/3     Running   0          121m
kube-system              vsphere-csi-node-llbm6                                   3/3     Running   0          121m
secretgen-controller     secretgen-controller-7b8d97d685-cjs2p                    1/1     Running   0          113m
service-bindings         manager-565d4bcc5d-4gncz                                 1/1     Running   0          23m
services-toolkit         services-toolkit-controller-manager-6c886958ff-2fh7c     1/1     Running   0          23m
source-system            source-controller-manager-7bfbdd67b6-kpmlp               1/1     Running   0          23m
spring-boot-convention   spring-boot-webhook-77b58f698d-p4s5n                     1/1     Running   0          18m
stacks-operator-system   controller-manager-5659768bbc-x6s4s                      1/1     Running   0          22m
tanzu-system-ingress     contour-7cc45654db-825gl                                 1/1     Running   0          18m
tanzu-system-ingress     contour-7cc45654db-hbzrc                                 1/1     Running   0          18m
tanzu-system-ingress     envoy-l6kdz                                              2/2     Running   0          18m
tanzu-system-ingress     envoy-m449h                                              2/2     Running   0          18m
tanzu-system-ingress     envoy-zl75p                                              2/2     Running   0          18m
tap-gui                  server-c7f5ccc57-fg8b4                                   1/1     Running   0          20m
tap-telemetry            tap-telemetry-controller-85f7984f86-lj9g7                1/1     Running   0          22m
tekton-pipelines         tekton-pipelines-controller-575cdd57cf-pqjmh             1/1     Running   0          23m
tekton-pipelines         tekton-pipelines-webhook-56d6487f86-hht6l                1/1     Running   0          23m
tkg-system               tanzu-capabilities-controller-manager-6ff97656b8-l2w25   1/1     Running   0          123m
triggermesh              aws-event-sources-controller-8457b5dc54-lspz7            1/1     Running   0          20m
vmware-sources           webhook-54b784cd94-wdqgt                                 1/1     Running   0          20m

リソース使用状況は次の通りです。

$ kubectl top node
NAME                           CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
leopard-control-plane-bz787    705m         35%    4319Mi          54%       
leopard-md-0-684dc87ff-25dfj   245m         6%     2342Mi          19%       
leopard-md-0-684dc87ff-2rx6r   221m         5%     2446Mi          20%       
leopard-md-0-684dc87ff-f5f7n   345m         8%     2723Mi          22%   

アプリケーションのデプロイ

TAP上にアプリケーションをデプロイしましょう。

事前準備

Service Accountへの設定

こちらのドキュメント の通り、アプリケーションをデプロイするnamespaceの作成、imagePullSecretの設定、及びRBACの設定が必要です。

今回はdemo namespaceを使用します。

kubectl create namespace demo

Tanzu Build Serviceが作成したイメージをpullするためのSecretを demo namespaceに作成します。

kubectl create secret docker-registry registry-credentials --docker-server=ghcr.io --docker-username=${GITHUB_USERNAME} --docker-password=${GITHUB_API_TOKEN} -n demo --dry-run=client -oyaml | kubectl apply -f-

default Service Accountに対して、imagePullSecretの設定とRoleBindingの設定を行います。なお、このService Account名は tap-values.yaml で変更可能です。

cat <<EOF | kubectl -n demo apply -f -
apiVersion: v1
kind: Secret
metadata:
  name: tap-registry
  annotations:
    secretgen.carvel.dev/image-pull-secret: ""
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: e30K
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: default
secrets:
- name: registry-credentials
imagePullSecrets:
- name: registry-credentials
- name: tap-registry
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: default
rules:
- apiGroups: [source.toolkit.fluxcd.io]
  resources: [gitrepositories]
  verbs: ['*']
- apiGroups: [source.apps.tanzu.vmware.com]
  resources: [imagerepositories]
  verbs: ['*']
- apiGroups: [carto.run]
  resources: [deliverables, runnables]
  verbs: ['*']
- apiGroups: [kpack.io]
  resources: [images]
  verbs: ['*']
- apiGroups: [conventions.apps.tanzu.vmware.com]
  resources: [podintents]
  verbs: ['*']
- apiGroups: [""]
  resources: ['configmaps']
  verbs: ['*']
- apiGroups: [""]
  resources: ['pods']
  verbs: ['list']
- apiGroups: [tekton.dev]
  resources: [taskruns, pipelineruns]
  verbs: ['*']
- apiGroups: [tekton.dev]
  resources: [pipelines]
  verbs: ['list']
- apiGroups: [kappctrl.k14s.io]
  resources: [apps]
  verbs: ['*']
- apiGroups: [serving.knative.dev]
  resources: ['services']
  verbs: ['*']
- apiGroups: [servicebinding.io]
  resources: ['servicebindings']
  verbs: ['*']
- apiGroups: [services.apps.tanzu.vmware.com]
  resources: ['resourceclaims']
  verbs: ['*']
- apiGroups: [scst-scan.apps.tanzu.vmware.com]
  resources: ['imagescans', 'sourcescans']
  verbs: ['*']
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: default
subjects:
- kind: ServiceAccount
  name: default
EOF
ドメイン名の登録

TAPへのHTTPリクエストはKnativeのIngress(ContourのEnvoy)が受け付けます。このEnvoyのIPアドレスをDNSに登録します。

この手順はOptionalです。この設定がなくてもTAPを試すことはできます。

EnvoyのIPアドレスは次のコマンドで確認できます。

kubectl get svc -n tanzu-system-ingress envoy -ojsonpath='{.status.loadBalancer.ingress[0].ip}'

この記事では*.leopard.maki.lolがこのEnvoyのIPを指すようにDNSに次のAレコードを登録します。

image

ClusterIssuerの設定と自動TLSの有効化

Knativeがcert-managerを使ってTLS証明証を払い出すように次の設定を行います。

この手順もOptionalです。この設定がなくてもTAPを試すことはできます。

TAP 0.4では、config-networkというConfigMapを直接editすることで設定できていましたが、TAP 0.4では直接変更した内容がrollbackされるようになったので、 cnrsのPackageInstallに無理矢理overlayを設定しています。この手順はおそらく、今後のリリースで変更されると思います。

なお、ここでは事前に作成したletsencrypt-maki-lolという名前のClusterIssuerを設定しています。 このClusterIssuerの作成は以下のletsencrypt-cluster-issuer-azuredns.ymlazuredns-config.ymlから作成しています。 https://github.com/categolj/k8s-manifests/tree/main/common/cluster-issuer

cat <<EOF > cnrs-overlay-auto-tls.yaml
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind":"ConfigMap", "metadata":{"name":"config-certmanager","namespace":"knative-serving"}})
---
data:
  #@overlay/match missing_ok=True
  issuerRef: |
    kind: ClusterIssuer
    name: letsencrypt-maki-lol

#@overlay/match by=overlay.subset({"kind":"ConfigMap", "metadata":{"name":"config-network","namespace":"knative-serving"}})
---
data:
  #@overlay/match missing_ok=True
  autoTLS: Enabled
EOF

kubectl -n tap-install create secret generic cnrs-overlay-auto-tls \
  -o yaml \
  --dry-run=client \
  --from-file=cnrs-overlay-auto-tls.yaml \
  | kubectl apply -f-

cat <<EOF >> tap-values.yaml

package_overlays:
- name: cnrs
  secrets:
  - name: cnrs-overlay-auto-tls
EOF

tanzu package installed update tap -n tap-install -v 0.4.0 -f tap-values.yaml

Workloadの作成

いよいよアプリケーションをデプロイします。アプリケーションは Cartographer のWorkload CRにより作成されます。

TAPでgitレポジトリのソースコードからアプリケーションをデプロイする方法と、ローカルファイルからアプリケーションをデプロイする方法、そして0.4からはGitOpsの3パターン選べます。

ソースコードはNode.jsのHello Worldアプリ (https://github.com/making/hello-nodejs) を使用します。

gitレポジトリからデプロイ

次のコマンドでデプロイできます。

tanzu apps workload create hello \
  --git-repo https://github.com/making/hello-nodejs \
  --git-branch master \
  --type web \
  --label app.kubernetes.io/part-of=hello \
  -n demo -y

次のコマンドでログを追跡できます。

tanzu apps workload tail hello -n demo 

作成されるリソースをwatchしたい場合は次のコマンドを実行してください。

watch kubectl get pod,gitrepo,imgs,build,podintent,taskrun,imagerepository,app,ksvc,certificate -n demo -owide

次のコマンドでアプリの情報を取得できます。

$ tanzu apps workload get hello -n demo
# hello: Ready
---
lastTransitionTime: "2021-12-26T12:44:14Z"
message: ""
reason: Ready
status: "True"
type: Ready

  Workload pods
  NAME                                      STATE       AGE
  hello-00001-deployment-78bdcd6b46-r2c9f   Running     37s
  hello-build-1-build-pod                   Succeeded   113s
  hello-config-writer-f8kbz-pod             Succeeded   73s

  Workload Knative Services
  NAME    READY   URL
  hello   Ready   https://hello.demo.leopard.maki.lol

ksvcが作成されてからcertificateが発行されるまで初回は1分かかります。その間はHTTPでのみアクセスできます。

作成されたリソースは以下の通りです。

$ kubectl get pod,gitrepo,imgs,build,podintent,taskrun,imagerepository,app,ksvc,certificate -n demo -owide

NAME                                          READY   STATUS      RESTARTS   AGE   IP            NODE                           NOMINATED NODE   READINESS GATES
pod/hello-00001-deployment-78bdcd6b46-r2c9f   2/2     Running     0          21s   100.96.1.60   leopard-md-0-684dc87ff-2rx6r   <none>           <none>
pod/hello-build-1-build-pod                   0/1     Completed   0          97s   100.96.1.58   leopard-md-0-684dc87ff-2rx6r   <none>           <none>
pod/hello-config-writer-f8kbz-pod             0/1     Completed   0          57s   100.96.1.59   leopard-md-0-684dc87ff-2rx6r   <none>           <none>

NAME                                           URL                                      READY   STATUS                                                              AGE
gitrepository.source.toolkit.fluxcd.io/hello   https://github.com/making/hello-nodejs   True    Fetched revision: master/a899e08152635aed391d0d44c980d9f6ed94f803   102s

NAME                   LATESTIMAGE                                                                                         READY
image.kpack.io/hello   ghcr.io/making/hello-demo@sha256:14b38dc469c2a47aebcb515019cfea5d97c8ca24ece372496c8f1a3902f8d4c9   True

NAME                           IMAGE                                                                                               SUCCEEDED
build.kpack.io/hello-build-1   ghcr.io/making/hello-demo@sha256:14b38dc469c2a47aebcb515019cfea5d97c8ca24ece372496c8f1a3902f8d4c9   True

NAME                                                READY   REASON   AGE
podintent.conventions.apps.tanzu.vmware.com/hello   True             64s

NAME                                           SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
taskrun.tekton.dev/hello-config-writer-f8kbz   True        Succeeded   57s         49s

NAME                                                          IMAGE                              URL                                                                                                                                                                                              READY   REASON   AGE
imagerepository.source.apps.tanzu.vmware.com/hello-delivery   ghcr.io/making/hello-demo-bundle   http://source-controller-manager-artifact-service.source-system.svc.cluster.local./imagerepository/demo/hello-delivery/6543689dc26c5b1d90d41e9425a28944817927fd726c6fd6d61d5482f65a881c.tar.gz   True             95s

NAME                         DESCRIPTION           SINCE-DEPLOY   AGE
app.kappctrl.k14s.io/hello   Reconcile succeeded   24s            24s

NAME                                URL                                   LATESTCREATED   LATESTREADY   READY   REASON
service.serving.knative.dev/hello   https://hello.demo.leopard.maki.lol   hello-00001     hello-00001   True    

NAME                                                                     READY   SECRET                                       ISSUER                 STATUS                                          AGE
certificate.cert-manager.io/route-8fd70ded-54b2-400e-8aa3-a31f36a1d453   True    route-8fd70ded-54b2-400e-8aa3-a31f36a1d453   letsencrypt-maki-lol   Certificate is up to date and has not expired   17s

出力されたURLにアクセスします。

$ curl https://hello.demo.leopard.maki.lol
Hello Tanzu!

対象のドメイン名に対して、cert-managerがLet's EncryptのTLS証明書を発行するのに初回は約1分かかります。それまではHTTPSではアクセスできず、HTTPでのみアクセスできます。

アプリケーションを更新したい場合は、変更したソースコードをgitにpushすれば自動でアプリが再デプロイされます。

作成されたリソースは次のコマンドで削除できます。

tanzu apps workload delete hello -y  
ローカルファイルからデプロイ

次のコマンドでデプロイできます。

git clone https://github.com/making/hello-nodejs
cd hello-nodejs
tanzu apps workload create hello-nodejs \
  --local-path . \
  --source-image ghcr.io/${GITHUB_USERNAME}/src \
  --type web \
  --label app.kubernetes.io/part-of=hello-nodejs \
  -n demo -y

次のコマンドでログを追跡できます。

tanzu apps workload tail hello-nodejs -n demo 

作成されるリソースをwatchしたい場合は次のコマンドを実行してください。

watch kubectl get pod,gitrepo,imgs,build,podintent,taskrun,imagerepository,app,ksvc,certificate -n demo -owide

次のコマンドでアプリの情報を取得できます。

$ tanzu apps workload get -n demo hello-nodejs
# hello-nodejs: Ready
---
lastTransitionTime: "2021-12-26T12:52:05Z"
message: ""
reason: Ready
status: "True"
type: Ready

  Workload pods
  NAME                                             STATE       AGE
  hello-nodejs-00001-deployment-8587975b4f-6vs72   Running     50s
  hello-nodejs-build-1-build-pod                   Succeeded   3m34s
  hello-nodejs-config-writer-j6f9x-pod             Succeeded   2m55s

  Workload Knative Services
  NAME           READY   URL

作成されたリソースは以下の通りです。

$ kubectl get pod,gitrepo,imgs,build,podintent,taskrun,imagerepository,app,ksvc,certificate -n demo -owide

NAME                                                 READY   STATUS       RESTARTS   AGE     IP            NODE                           NOMINATED NODE   READINESS GATES
pod/hello-nodejs-00001-deployment-8587975b4f-6vs72   2/2     Running      0          24s     100.96.2.39   leopard-md-0-684dc87ff-25dfj   <none>           <none>
pod/hello-nodejs-build-1-build-pod                   0/1     Completed    0          3m8s    100.96.1.61   leopard-md-0-684dc87ff-2rx6r   <none>           <none>
pod/hello-nodejs-config-writer-j6f9x-pod             0/1     Completed    0          2m29s   100.96.1.62   leopard-md-0-684dc87ff-2rx6r   <none>           <none>

NAME                          LATESTIMAGE                                                                                                READY
image.kpack.io/hello-nodejs   ghcr.io/making/hello-nodejs-demo@sha256:d8dbac521fb302e999b809bff9a9e11bc22c011136792a585dc21f13f871451b   True

NAME                                  IMAGE                                                                                                      SUCCEEDED
build.kpack.io/hello-nodejs-build-1   ghcr.io/making/hello-nodejs-demo@sha256:d8dbac521fb302e999b809bff9a9e11bc22c011136792a585dc21f13f871451b   True

NAME                                                       READY   REASON   AGE
podintent.conventions.apps.tanzu.vmware.com/hello-nodejs   True             2m38s

NAME                                                  SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
taskrun.tekton.dev/hello-nodejs-config-writer-j6f9x   True        Succeeded   2m30s       2m23s

NAME                                                                 IMAGE                                                                                               URL                                                                                                                                                                                                     READY   REASON   AGE
imagerepository.source.apps.tanzu.vmware.com/hello-nodejs            ghcr.io/making/src:latest@sha256:a7562d39ee309767c52f6b85974d37e9dd8685f75c1eaeb613306a6ab5c179c3   http://source-controller-manager-artifact-service.source-system.svc.cluster.local./imagerepository/demo/hello-nodejs/a7562d39ee309767c52f6b85974d37e9dd8685f75c1eaeb613306a6ab5c179c3.tar.gz            True             3m21s
imagerepository.source.apps.tanzu.vmware.com/hello-nodejs-delivery   ghcr.io/making/hello-nodejs-demo-bundle                                                             http://source-controller-manager-artifact-service.source-system.svc.cluster.local./imagerepository/demo/hello-nodejs-delivery/41d4e873c7cb91144a6fb8fcaf6bfa79795e71d2626269cfd35baff918a969b4.tar.gz   True             3m7s

NAME                                DESCRIPTION           SINCE-DEPLOY   AGE
app.kappctrl.k14s.io/hello-nodejs   Reconcile succeeded   15s            118s

NAME                                       URL                                          LATESTCREATED        LATESTREADY          READY   REASON
service.serving.knative.dev/hello-nodejs   https://hello-nodejs.demo.leopard.maki.lol   hello-nodejs-00001   hello-nodejs-00001   True    

NAME                                                                     READY   SECRET                                       ISSUER                 STATUS                                          AGE
certificate.cert-manager.io/route-4098da74-774a-4b64-a930-248db5eacd12   True    route-4098da74-774a-4b64-a930-248db5eacd12   letsencrypt-maki-lol   Certificate is up to date and has not expired   111s

出力されたURLにアクセスします。

$ curl https://hello-nodejs.demo.leopard.maki.lol
Hello Tanzu!

アプリケーションを更新したい場合は、ソースコード変更後に tanzu apps workload update -n demo hello-nodejs --local-path . -y

GitOpsでデプロイ

TAP 0.4からはGitOpsのワークフローも作成できるようになりました。

参考ドキュメントは こちら

まず、manifestを管理するgitレポジトリをGitHubで作成ます。空の状態から https://github.com/making/hello-nodejs-manifests を作成しました。

image

Gitレポジトリにpushするためのssh鍵を作成します。

cd $HOME/tanzu
ssh-keygen -t ssh-ed25519 -q -b 4096 -f "identity" -N "" -C ""
ssh-keyscan github.com > ./known_hosts

identity.pubをDeploy Keysに登録します。

image

次のコマンドでSecretを作成します。

kubectl create secret generic git-ssh -n demo \
    --type kubernetes.io/ssh-auth \
    --from-file=./known_hosts \
    --from-file=./identity \
    --from-file=./identity.pub \
    --from-file=ssh-privatekey=./identity \
    --dry-run=client -oyaml \
 | kubectl apply -f- 
kubectl -n demo annotate secret git-ssh tekton.dev/git-0=github.com --overwrite=true   
kubectl patch -n demo serviceaccount default -p "{\"secrets\":[{\"name\":\"git-ssh\"}]}"

次のコマンドでデプロイできます。

tanzu apps workload create hello-tap \
  --git-repo https://github.com/making/hello-nodejs \
  --git-branch master \
  --param delivery_git_branch=main \
  --param delivery_git_commit_message=Bump \
  --param delivery_git_repository=ssh://git@github.com:making/hello-nodejs-manifests.git \
  --param delivery_git_user_email=makingx+bot@gmail.com \
  --param delivery_git_user_name=making-bot \
  --param delivery_git_ssh_secret=git-ssh \
  --type web \
  --label app.kubernetes.io/part-of=hello-tap \
  -n demo -y

次のコマンドでログを追跡できます。

tanzu apps workload tail hello-tap -n demo 

作成されるリソースをwatchしたい場合は次のコマンドを実行してください。

watch kubectl get pod,gitrepo,imgs,build,podintent,taskrun,imagerepository,app,ksvc,certificate -n demo -owide

kpackによるコンテナイメージのビルドが終わると、そのイメージのdigestを使用してmanifestをgit commit & pushがTektonによって行われます。 gitレポジトリを見ると次のコミットが自動で行われていることがわかります。

image

pushされたmanifestは次の通りです。

image

次のコマンドでアプリの情報を取得できます。

$ tanzu apps workload get -n demo hello-tap   
# hello-tap: Ready
---
lastTransitionTime: "2021-12-27T07:55:05Z"
message: ""
reason: Ready
status: "True"
type: Ready

Workload pods
NAME                                          STATE       AGE
hello-tap-00001-deployment-64c98797d9-vzpqn   Running     2m23s
hello-tap-build-1-build-pod                   Succeeded   95m
hello-tap-config-writer-9wxjq-pod             Succeeded   12m

Workload Knative Services
NAME        READY   URL
hello-tap   Ready   https://hello-tap.demo.leopard.maki.lol

作成されたリソースは以下の通りです。manifestの変更を検知するためのGitRepositoryリソース(hello-tap-delivery)ができていることがわかります。

$ kubectl get pod,gitrepo,imgs,build,podintent,taskrun,imagerepository,app,ksvc,certificate -n demo -owide

NAME                                              READY   STATUS      RESTARTS   AGE     IP            NODE                           NOMINATED NODE   READINESS GATES
pod/hello-tap-00001-deployment-64c98797d9-vzpqn   2/2     Running     0          96s     100.96.1.75   leopard-md-0-684dc87ff-2rx6r   <none>           <none>
pod/hello-tap-build-1-build-pod                   0/1     Completed   0          94m     100.96.1.70   leopard-md-0-684dc87ff-2rx6r   <none>           <none>
pod/hello-tap-config-writer-9wxjq-pod             0/1     Completed   0          11m     100.96.1.72   leopard-md-0-684dc87ff-2rx6r   <none>           <none>

NAME                                                        URL                                                      READY   STATUS                                                              AGE
gitrepository.source.toolkit.fluxcd.io/hello-tap            https://github.com/making/hello-nodejs                   True    Fetched revision: master/3901792b97ccc388efcbdf05849b62f46326febb   94m
gitrepository.source.toolkit.fluxcd.io/hello-tap-delivery   ssh://git@github.com/making/hello-nodejs-manifests.git   True    Fetched revision: main/9711e153a777973a01946e928520a2bf498cd940     102s

NAME                       LATESTIMAGE                                                                                             READY
image.kpack.io/hello-tap   ghcr.io/making/hello-tap-demo@sha256:169bffd3bd91069edf2dde84cffbca66697a9736e0273a93ab2d86fa4c25f910   True

NAME                               IMAGE                                                                                                   SUCCEEDED
build.kpack.io/hello-tap-build-1   ghcr.io/making/hello-tap-demo@sha256:169bffd3bd91069edf2dde84cffbca66697a9736e0273a93ab2d86fa4c25f910   True

NAME                                                    READY   REASON   AGE
podintent.conventions.apps.tanzu.vmware.com/hello-tap   True             93m

NAME                                               SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
taskrun.tekton.dev/hello-tap-config-writer-9wxjq   True        Succeeded   11m         11m

NAME                             DESCRIPTION           SINCE-DEPLOY   AGE
app.kappctrl.k14s.io/hello-tap   Reconcile succeeded   29s            100s

NAME                                    URL                                       LATESTCREATED     LATESTREADY       READY   REASON
service.serving.knative.dev/hello-tap   https://hello-tap.demo.leopard.maki.lol   hello-tap-00001   hello-tap-00001   True    

NAME                                                                     READY   SECRET                                       ISSUER                 STATUS                                          AGE
certificate.cert-manager.io/route-23bb9c3b-5391-4186-aa1b-29baa5c0b1b6   True    route-23bb9c3b-5391-4186-aa1b-29baa5c0b1b6   letsencrypt-maki-lol   Certificate is up to date and has not expired   91s

出力されたURLにアクセスします。

$ curl https://hello-tap.demo.leopard.maki.lol
Hello Tanzu!

なお、ソースコードを変更してgit pushすると、新しいコンテナイメージがビルドされ、manifestも新しいイメージのdigestを使用するようにcommit & pushされます。 次のようなコミットになります。

image

tanzu apps workload createコマンドだけでGitOpsのパイプラインが出来上がって便利です。

なおこのmanifestファイル(config/delivery.yaml)を直接変更しても、次のTektonのTaskRunで上書きされます。 デプロイ内容を変更したい場合は別ファイルにyttのoverlayを書くと反映されます。


Tanzu Application Serviceの機能は他にもいろいろありますが、本記事では最も基本的な"Source to URL"の機能を試しました。


✒️️ Edit  ⏰ History  🗑 Delete