This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
114 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Deploying to Kubernetes | ||
|
||
> NOTE: The provided `config/workload.yaml` file uses the Git URL for this sample. When you want to modify the source, you must push the code to your own Git repository and then update the `spec.source.git` information in the `config/workload.yaml` file. | ||
## Deploying to Kubernetes as a TAP workload with Tilt | ||
|
||
You can containerize this template app and deploy it as a Tanzu Application Platform (TAP) workload. | ||
You need to have TAP installed on your cluster. | ||
See the [VMware Tanzu Application Platform documentation](https://docs.vmware.com/en/VMware-Tanzu-Application-Platform/index.html) for details. | ||
|
||
We have included a `Tiltfile` file to make this easier when deploying to a cluster. | ||
|
||
For best results use Tilt version v0.23.2 or later. You can install Tilt by following these instructions: https://docs.tilt.dev/install.html | ||
|
||
To set up the deployment environment set the CURRENT_CONTEXT environment variable. | ||
|
||
Set CURRENT_CONTEXT using: | ||
|
||
``` | ||
export CURRENT_CONTEXT=$(kubectl config current-context) | ||
``` | ||
|
||
To build and deploy the app run: | ||
|
||
``` | ||
tilt up | ||
``` | ||
|
||
and follow the instructions (hitting space bar brings up the Tilt interface in your browser). | ||
|
||
To uninstall the app run: | ||
|
||
``` | ||
tilt down | ||
``` | ||
|
||
## Accessing the app deployed to your cluster | ||
|
||
If you don't have `curl` installed it can be installed using downloads here: https://curl.se/download.html | ||
|
||
Determine the URL to use for the accessing the app by running: | ||
|
||
``` | ||
tanzu apps workload get node-express | ||
``` | ||
|
||
To access the deployed app open the URL shown in your browser. | ||
|
||
This depends on the TAP installation having DNS configured for the Knative ingress. | ||
|
||
## Deploying to Kubernetes as a TAP workload with Tanzu CLI | ||
|
||
When you are done developing your app, you can simply deploy it using: | ||
|
||
``` | ||
tanzu apps workload apply -f config/workload.yaml | ||
``` | ||
|
||
If you would like deploy the code from your local working directory you can use the following command: | ||
|
||
``` | ||
tanzu apps workload create node-express -f config/workload.yaml \ | ||
--local-path . \ | ||
--source-image <REPOSITORY-PREFIX>/node-express-source \ | ||
--type web | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
allow_k8s_contexts(os.getenv("CURRENT_CONTEXT", default='kind-kind')) | ||
|
||
NAMESPACE = os.getenv("NAMESPACE", default='default') | ||
|
||
k8s_custom_deploy( | ||
'node-express', | ||
apply_cmd="tanzu apps workload apply -f config/workload.yaml " + | ||
" --namespace " + NAMESPACE + | ||
" --yes >/dev/null" + | ||
" && kubectl get workload node-express --namespace " + NAMESPACE + " -o yaml", | ||
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes", | ||
deps=['package.json', 'server.js'], | ||
) | ||
|
||
k8s_resource('node-express', extra_pod_selectors=[{'serving.knative.dev/service': 'node-express'}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: node-express | ||
description: Node Express Sample App | ||
tags: | ||
- app-accelerator | ||
- node | ||
- express | ||
- tanzu | ||
annotations: | ||
'backstage.io/kubernetes-label-selector': 'app.kubernetes.io/part-of=node-express' | ||
spec: | ||
type: service | ||
lifecycle: experimental | ||
owner: default-team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.