Deploy an Application
You'll now deploy a sample application into your cluster, and verify success using tctl
and the TSB UI:
- Create a namespace for the application, and apply the
istio-injection=enabled
label - Deploy the bookinfo application as normal into the new namespace
- Create a TSB Workspace container to scope the TSB configuration
- Verify success
A TSB Workspace spans one or more namespaces across one or more K8s clusters. Configuration applied to a Workspace is applied to services and gateways across these cluster/namespace selectors.
Workspaces allow you to model configuration from an application or gateway-set perspective, without being constrained by the underlying namespace and cluster topology.
Deploy and View the application
Apply the Configuration
Create a new namespace and deploy the application within. Create the Tetrate
Workspace
resource to scope the Tetrate configuration.Edit the
ORG
(organization),TEN
(tenant),NS
(namespace) names if needed:export NS=bookinfo
export ORG=tetrate
export TEN=default
echo "\nCreate the namespace ..."
kubectl create namespace ${NS}
kubectl label namespace ${NS} istio-injection=enabled
echo "\nDeploy the application ..."
kubectl apply -n ${NS} -f https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/platform/kube/bookinfo.yaml
echo "\nCreate the TSB ${NS}-ws Workspace ..."
cat <<EOF > ${NS}-workspace.yaml
apiversion: api.tsb.tetrate.io/v2
kind: Workspace
metadata:
organization: ${ORG}
tenant: ${TEN}
name: ${NS}-ws
spec:
description: Test ${NS} workspace
namespaceSelector:
names:
- "*/${NS}"
EOF
tctl apply -f ${NS}-workspace.yamlNote that
tctl
is used to apply configuration to TSB, andkubectl
to apply standard K8s configuration to the cluster.Verify the Deployment
Confirm that the pods are running in the
bookinfo
namespace. Note the2/2
status, indicating that two containers (application and Istio sidecar) are running in each pod:kubectl get pods -n ${NS}
NAME READY STATUS RESTARTS AGE
details-v1-766844796b-tc9mf 2/2 Running 0 53s
productpage-v1-54bb874995-pbhm5 2/2 Running 0 52s
ratings-v1-5dc79b6bcd-t6l2g 2/2 Running 0 53s
reviews-v1-598b896c9d-f2vx6 2/2 Running 0 53s
reviews-v2-556d6457d-d2tdd 2/2 Running 0 53s
reviews-v3-564544b4d6-kxhtc 2/2 Running 0 53sConfirm that the application is functioning, by sending a request from the ratings pod to the productpage service:
kubectl exec deploy/ratings-v1 -n ${NS} -- curl -s productpage:9080/productpage | grep -o "<title>.*</title>"
<title>Simple Bookstore App</title>View the Services in the TSB Workspace
Inspect the newly-created TSB Workspace, named bookinfo-ws or similar:
What have we achieved?
We have seen how to create and mesh-enable a namespace, and how to create the corresponding Tetrate WorkSpace
resource to scope Tetrate configuration for that namespace.