Deploy an Application
In this quickstart page, you’re going to deploy a sample application in a demo
TSB environment and validate the success using the TSB UI, and tctl
commands.
Before you get started make sure that you:
✓ Familiarize yourself with TSB concepts including workspaces and groups
✓ Install the TSB demo
The TSB demo install will do everything for you, including onboarding a cluster and installing all the operators that you’ll need. It will also provide you with the URL and admin login information to access the TSB UI.
Deploying a Demo Application
You’re going to use the classic Istio bookinfo demo application
to test TSB’s functionality. So make sure that you have the below YAML configuration saved
as bookinfo.yaml
. You can also download it from here.
# Copyright 2017 Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Namespace
metadata:
name: bookinfo
labels:
istio-injection: enabled
---
##################################################################################################
# Details service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: details
labels:
app: details
service: details
spec:
ports:
- port: 9080
name: http
selector:
app: details
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: details-v1
labels:
app: details
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: details
version: v1
template:
metadata:
labels:
app: details
version: v1
spec:
containers:
- name: details
image: istio/examples-bookinfo-details-v1:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# Ratings service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: ratings
labels:
app: ratings
service: ratings
spec:
ports:
- port: 9080
name: http
selector:
app: ratings
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ratings-v1
labels:
app: ratings
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: ratings
version: v1
template:
metadata:
labels:
app: ratings
version: v1
spec:
containers:
- name: ratings
image: istio/examples-bookinfo-ratings-v1:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# Reviews service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: reviews
labels:
app: reviews
service: reviews
spec:
ports:
- port: 9080
name: http
selector:
app: reviews
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: reviews-v1
labels:
app: reviews
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: reviews
version: v1
template:
metadata:
labels:
app: reviews
version: v1
spec:
containers:
- name: reviews
image: istio/examples-bookinfo-reviews-v1:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: reviews-v2
labels:
app: reviews
version: v2
spec:
replicas: 1
selector:
matchLabels:
app: reviews
version: v2
template:
metadata:
labels:
app: reviews
version: v2
spec:
containers:
- name: reviews
image: istio/examples-bookinfo-reviews-v2:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: reviews-v3
labels:
app: reviews
version: v3
spec:
replicas: 1
selector:
matchLabels:
app: reviews
version: v3
template:
metadata:
labels:
app: reviews
version: v3
spec:
containers:
- name: reviews
image: istio/examples-bookinfo-reviews-v3:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# Productpage services
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: productpage
labels:
app: productpage
service: productpage
spec:
ports:
- port: 9080
name: http
selector:
app: productpage
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: productpage-v1
labels:
app: productpage
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: productpage
version: v1
template:
metadata:
labels:
app: productpage
version: v1
spec:
containers:
- name: productpage
image: istio/examples-bookinfo-productpage-v1:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
Deploy bookinfo
Deploy the bookinfo application to your cluster using the following kubectl
command:
kubectl apply -n bookinfo -f bookinfo.yaml
Confirm your services are running
To confirm all of your services and pods are running, validate with:
kubectl get pods -n bookinfo
Expected output:
NAME READY STATUS RESTARTS AGE
details-v1-5bc5dccd95-2qx8b 2/2 Running 0 38m
productpage-v1-f56bc8d5c-42kcg 2/2 Running 0 38m
ratings-v1-68f58946ff-vcrdh 2/2 Running 0 38m
reviews-v1-5976d456d4-nltg2 2/2 Running 0 38m
reviews-v2-57cf5b5488-rgq8l 2/2 Running 0 38m
reviews-v3-7745dbf976-4gnl9 2/2 Running 0 38m
Make sure you can access the bookinfo application
Confirm that you can access the bookinfo application:
kubectl exec "$(kubectl get pod -n bookinfo -l app=ratings -o jsonpath='{.items[0].metadata.name}')" \
-n bookinfo -c ratings -- curl -s productpage:9080/productpage | \
grep -o "<title>.*</title>"
You will see something similar to:
<title>Simple Bookstore App</title>
Verify that your application is onboarded into TSB
To confirm that your application is onboarded to TSB using the UI, navigate to the Services page by selecting the bottom button on the left side banner. You’ll see all your services running.
To use tctl
, run
tctl get clusters demo -o yaml | grep bookinfo
You'll see the following:
- name: bookinfo
- hostname: details.bookinfo.svc.cluster.local
namespace: bookinfo
- hostname: productpage.bookinfo.svc.cluster.local
namespace: bookinfo
- hostname: ratings.bookinfo.svc.cluster.local
namespace: bookinfo
- hostname: reviews.bookinfo.svc.cluster.local
namespace: bookinfo