$ oc login https://{HOSTNAME}:6443
After installing the Operators and ServiceMeshControlPlane
resource, add applications, workloads, or services to your mesh by creating a ServiceMeshMemberRoll
resource and specifying the namespaces where your content is located. If you already have an application, workflow, or service to add to a ServiceMeshMemberRoll
resource, use the following steps. Or, to install a sample application called Bookinfo and add it to a ServiceMeshMemberRoll
resource, skip to the tutorial for installing the Bookinfo example application to see how an application works in Maistra Service Mesh.
The items listed in the ServiceMeshMemberRoll
resource are the applications and workflows that are managed by the ServiceMeshControlPlane
resource. The control plane, which includes the Maistra Operators, Istiod, and ServiceMeshControlPlane
, and the data plane, which includes applications and Envoy proxy, must be in separate namespaces.
Note
|
After you add the namespace to the |
The ServiceMeshMemberRoll
lists the projects that belong to the control plane. Only projects listed in the ServiceMeshMemberRoll
are affected by the control plane. A project does not belong to a service mesh until you add it to the member roll for a particular control plane deployment.
You must create a ServiceMeshMemberRoll
resource named default
in the same project as the ServiceMeshControlPlane
, for example istio-system
.
You can add one or more projects to the Maistra member roll from the web console. In this example, istio-system
is the name of the control plane project.
An installed, verified Maistra Service Mesh Operator.
List of existing projects to add to the service mesh.
Log in to the OpenShift Container Platform web console.
If you do not already have services for your mesh, or you are starting from scratch, create a project for your applications. It must be different from the project where you installed the control plane.
Navigate to Home → Projects.
Enter a name in the Name field.
Click Create.
Navigate to Operators → Installed Operators.
Click the Project menu and choose the project where your ServiceMeshControlPlane
resource is deployed from the list, for example istio-system
.
Click the Maistra Service Mesh Operator.
Click the Istio Service Mesh Member Roll tab.
Click Create ServiceMeshMemberRoll
Click Members, then enter the name of your project in the Value field. You can add any number of projects, but a project can only belong to one ServiceMeshMemberRoll
resource.
Click Create.
You can add a project to the ServiceMeshMemberRoll
from the command line.
An installed, verified Maistra Service Mesh Operator.
List of projects to add to the service mesh.
Access to the OpenShift CLI (oc
).
Log in to the OpenShift Container Platform CLI.
$ oc login https://{HOSTNAME}:6443
If you do not already have services for your mesh, or you are starting from scratch, create a project for your applications. It must be different from the project where you installed the control plane.
$ oc new-project {your-project}
To add your projects as members, modify the following example YAML. You can add any number of projects, but a project can only belong to one ServiceMeshMemberRoll
resource. In this example, istio-system
is the name of the control plane project.
apiVersion: maistra.io/v1
kind: ServiceMeshMemberRoll
metadata:
name: default
namespace: istio-system
spec:
members:
# a list of projects joined into the service mesh
- your-project-name
- another-project-name
Run the following command to upload and create the ServiceMeshMemberRoll
resource in the istio-system
namespace.
$ oc create -n istio-system -f servicemeshmemberroll-default.yaml
Run the following command to verify the ServiceMeshMemberRoll
was created successfully.
$ oc get smmr -n istio-system default
The installation has finished successfully when the STATUS
column is Configured
.
You can add or remove projects from an existing Maistra ServiceMeshMemberRoll
resource using the web console.
You can add any number of projects, but a project can only belong to one ServiceMeshMemberRoll
resource.
The ServiceMeshMemberRoll
resource is deleted when its corresponding ServiceMeshControlPlane
resource is deleted.
An installed, verified Maistra Service Mesh Operator.
An existing ServiceMeshMemberRoll
resource.
Name of the project with the ServiceMeshMemberRoll
resource.
Names of the projects you want to add or remove from the mesh.
Log in to the OpenShift Container Platform web console.
Navigate to Operators → Installed Operators.
Click the Project menu and choose the project where your ServiceMeshControlPlane
resource is deployed from the list, for example istio-system
.
Click the Maistra Service Mesh Operator.
Click the Istio Service Mesh Member Roll tab.
Click the default
link.
Click the YAML tab.
Modify the YAML to add or remove projects as members. You can add any number of projects, but a project can only belong to one ServiceMeshMemberRoll
resource.
Click Save.
Click Reload.
You can modify an existing Maistra member roll using the command line.
An installed, verified Maistra Service Mesh Operator.
An existing ServiceMeshMemberRoll
resource.
Name of the project with the ServiceMeshMemberRoll
resource.
Names of the projects you want to add or remove from the mesh.
Access to the OpenShift CLI (oc
).
Log in to the OpenShift Container Platform CLI.
Edit the ServiceMeshMemberRoll
resource.
$ oc edit smmr -n <controlplane-namespace>
Modify the YAML to add or remove projects as members. You can add any number of projects, but a project can only belong to one ServiceMeshMemberRoll
resource.
apiVersion: maistra.io/v1
kind: ServiceMeshMemberRoll
metadata:
name: default
namespace: istio-system #control plane project
spec:
members:
# a list of projects joined into the service mesh
- your-project-name
- another-project-name
The Bookinfo example application allows you to test your Maistra Service Mesh 2.1 installation on OpenShift Container Platform.
The Bookinfo application displays information about a book, similar to a single catalog entry of an online book store. The application displays a page that describes the book, book details (ISBN, number of pages, and other information), and book reviews.
The Bookinfo application consists of these microservices:
The productpage
microservice calls the details
and reviews
microservices to populate the page.
The details
microservice contains book information.
The reviews
microservice contains book reviews. It also calls the ratings
microservice.
The ratings
microservice contains book ranking information that accompanies a book review.
There are three versions of the reviews microservice:
Version v1 does not call the ratings
Service.
Version v2 calls the ratings
Service and displays each rating as one to five black stars.
Version v3 calls the ratings
Service and displays each rating as one to five red stars.
This tutorial walks you through how to create a sample application by creating a project, deploying the Bookinfo application to that project, and viewing the running application in Maistra.
OpenShift Container Platform 4.1 or higher installed.
Maistra Service Mesh 2.1 installed.
Access to the OpenShift CLI (oc
).
An account with the cluster-admin
role.
Note
|
The Bookinfo sample application cannot be installed on IBM Z and IBM Power Systems. |
Note
|
The commands in this section assume the control plane project is |
Log in to the OpenShift Container Platform web console as a user with cluster-admin rights. If you use Red Hat OpenShift Dedicated, you must have an account with the dedicated-admin
role.
Click Home → Projects.
Click Create Project.
Enter bookinfo
as the Project Name, enter a Display Name, and enter a Description, then click Create.
Alternatively, you can run this command from the CLI to create the bookinfo
project.
$ oc new-project bookinfo
Click Operators → Installed Operators.
Click the Project menu and use the control plane namespace. In this example, use istio-system
.
Click the Maistra Service Mesh Operator.
Click the Istio Service Mesh Member Roll tab.
If you have already created a Istio Service Mesh Member Roll, click the name, then click the YAML tab to open the YAML editor.
If you have not created a ServiceMeshMemberRoll
, click Create ServiceMeshMemberRoll.
Click Members, then enter the name of your project in the Value field.
Click Create to save the updated Service Mesh Member Roll.
Or, save the following example to a YAML file.
apiVersion: maistra.io/v1
kind: ServiceMeshMemberRoll
metadata:
name: default
spec:
members:
- bookinfo
Run the following command to upload that file and create the ServiceMeshMemberRoll
resource in the istio-system
namespace. In this example, istio-system
is the name of the control plane project.
$ oc create -n istio-system -f servicemeshmemberroll-default.yaml
Run the following command to verify the ServiceMeshMemberRoll
was created successfully.
$ oc get smmr -n istio-system
The installation has finished successfully when the STATUS
column is Configured
.
NAME READY STATUS AGE
default 1/1 Configured 2m27s
From the CLI, deploy the Bookinfo application in the `bookinfo` project by applying the bookinfo.yaml
file:
$ oc apply -n bookinfo -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/platform/kube/bookinfo.yaml
You should see output similar to the following:
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
Create the ingress gateway by applying the bookinfo-gateway.yaml
file:
$ oc apply -n bookinfo -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/networking/bookinfo-gateway.yaml
You should see output similar to the following:
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created
Set the value for the GATEWAY_URL
parameter:
$ export GATEWAY_URL=$(oc -n istio-system get route istio-ingressgateway -o jsonpath='{.spec.host}')
Before you can use the Bookinfo application, you must first add default destination rules. There are two preconfigured YAML files, depending on whether or not you enabled mutual transport layer security (TLS) authentication.
To add destination rules, run one of the following commands:
If you did not enable mutual TLS:
$ oc apply -n bookinfo -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/networking/destination-rule-all.yaml
If you enabled mutual TLS:
$ oc apply -n bookinfo -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/networking/destination-rule-all-mtls.yaml
You should see output similar to the following:
destinationrule.networking.istio.io/productpage created
destinationrule.networking.istio.io/reviews created
destinationrule.networking.istio.io/ratings created
destinationrule.networking.istio.io/details created
To confirm that the sample Bookinfo application was successfully deployed, perform the following steps.
Maistra Service Mesh 2.1 installed.
Access to the OpenShift CLI (oc
).
Complete the steps for installing the Bookinfo sample app.
Log in to the OpenShift Container Platform CLI.
Verify that all pods are ready with this command:
$ oc get pods -n bookinfo
All pods should have a status of Running
. You should see output similar to the following:
NAME READY STATUS RESTARTS AGE
details-v1-55b869668-jh7hb 2/2 Running 0 12m
productpage-v1-6fc77ff794-nsl8r 2/2 Running 0 12m
ratings-v1-7d7d8d8b56-55scn 2/2 Running 0 12m
reviews-v1-868597db96-bdxgq 2/2 Running 0 12m
reviews-v2-5b64f47978-cvssp 2/2 Running 0 12m
reviews-v3-6dfd49b55b-vcwpf 2/2 Running 0 12m
Run the following command to retrieve the URL for the product page:
echo "http://$GATEWAY_URL/productpage"
Copy and paste the output in a web browser to verify the Bookinfo product page is deployed.
Follow these steps to remove the Bookinfo application.
OpenShift Container Platform 4.1 or higher installed.
Maistra Service Mesh 2.1 installed.
Access to the OpenShift CLI (oc
).
Log in to the OpenShift Container Platform web console.
Click to Home → Projects.
Click the bookinfo
menu , and then click Delete Project.
Type bookinfo
in the confirmation dialog box, and then click Delete.
Alternatively, you can run this command from the CLI to create the bookinfo
project.
$ oc delete project bookinfo
Log in to the OpenShift Container Platform web console.
Click Operators → Installed Operators.
Click the Project menu and choose openshift-operators
from the list.
Click the Istio Service Mesh Member Roll link under Provided APIS for the Maistra Service Mesh Operator.
Click the ServiceMeshMemberRoll
menu and select Edit Service Mesh Member Roll.
Edit the default Service Mesh Member Roll YAML and remove bookinfo
from the members list.
Alternatively, you can run this command from the CLI to remove the bookinfo
project from the ServiceMeshMemberRoll
. In this example, istio-system
is the name of the control plane project.
$ oc -n istio-system patch --type='json' smmr default -p '[{"op": "remove", "path": "/spec/members", "value":["'"bookinfo"'"]}]'
Click Save to update Service Mesh Member Roll.
To continue the installation process, you must enable sidecar injection.