Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 3. Creating a router network
To create a network of AMQ Interconnect routers, you define a deployment in an Interconnect
Custom Resource, and then apply it. The AMQ Interconnect Operator creates the deployment by scheduling the necessary Pods and creating any needed Resources.
The procedures in this section demonstrate the following router network topologies:
- Interior router mesh
- Interior router mesh with edge routers for scalability
- Inter-cluster router network that connects two OpenShift clusters
Prerequisites
- The AMQ Interconnect Operator is installed in your OpenShift Container Platform project.
3.1. Creating an interior router deployment Copier lienLien copié sur presse-papiers!
Interior routers establish connections with each other and automatically compute the lowest cost paths across the network.
Procedure
This procedure creates an interior router network of three routers. The routers automatically connect to each other in a mesh topology, and their connections are secured with mutual SSL/TLS authentication.
Create an
Interconnect
Custom Resource YAML file that describes the interior router deployment.Sample
router-mesh.yaml
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The operating mode of the routers in the deployment. The Operator will automatically connect interior routers in a mesh topology.
- 2
- The number of routers to create.
- 3
- Each router runs in a separate Pod. The placement defines where in the cluster the Operator should schedule and place the Pods. You can choose the following placement options:
Any
- The Pods can run on any node in the OpenShift Container Platform cluster.
Every
-
The Operator places a router Pod on each node in the cluster. If you choose this option, the
Size
property is not needed - the number of routers corresponds to the number of nodes in the cluster. Anti-Affinity
-
The Operator ensures that multiple router Pods do not run on the same node in the cluster. If the size is greater than the number of nodes in the cluster, the extra Pods that cannot be scheduled will remain in a
Pending
state.
Create the router deployment described in the YAML file.
oc apply -f router-mesh.yaml
$ oc apply -f router-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Operator creates a deployment of interior routers in a mesh topology that uses default address semantics. It also creates a Service through which the routers can be accessed, and a Route through which you can access the web console.
Verify that the router mesh was created and the Pods are running.
Each router runs in a separate Pod. They connect to each other automatically using the Service that the Operator created.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review the router deployment.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The default address configuration. All messages sent to an address that does not match any of these prefixes are distributed in a balanced anycast pattern.
- 2
- A router mesh of three interior routers was deployed.
- 3
- Each interior router listens on port
45672
for connections from edge routers. - 4
- The interior routers connect to each other on port
55671
. These inter-router connections are secured with SSL/TLS mutual authentication. Theinter-router
SSL Profile contains the details of the certificates that the Operator generated. - 5
- Each interior router listens for connections from external clients on the following ports:
-
5672
- Unsecure connections from messaging applications. -
5671
- Secure connections from messaging applications. -
8080
- AMQ Interconnect web console access. Default user name/password security is applied.
-
- 6
- Using the AMQ Certificate Manager Operator, the AMQ Interconnect Operator automatically creates two SSL profiles:
-
inter-router
- The Operator secures the inter-router network with mutual TLS authentication by creating a Certificate Authority (CA) and generating certificates signed by the CA for each interior router. -
default
- The Operator creates TLS certificates for messaging applications to connect to the interior routers on port5671
.
-
- 7
- The AMQ Interconnect web console is secured with user name/password authentication. The Operator automatically generates the credentials and stores them in the
router-mesh-users
Secret.
3.2. Creating an edge router deployment Copier lienLien copié sur presse-papiers!
You can efficiently scale your router network by adding an edge router deployment. Edge routers act as connection concentrators for messaging applications. Each edge router maintains a single uplink connection to an interior router, and messaging applications connect to the edge routers to send and receive messages.
Prerequisites
- The interior router mesh is deployed. For more information, see Section 3.1, “Creating an interior router deployment”.
Procedure
This procedure creates an edge router on each node of the OpenShift Container Platform cluster and connects them to the previously created interior router mesh.
Create an
Interconnect
Custom Resource YAML file that describes the edge router deployment.Sample
edge-routers.yaml
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- An edge router Pod will be deployed on each node in the OpenShift Container Platform cluster. This placement helps to balance messaging application traffic across the cluster. The Operator will create a DaemonSet to ensure that the number of Pods scheduled always corresponds to the number of nodes in the cluster.
- 2
- Edge connectors define the connections from the edge routers to the interior routers.
- 3
- The name of the Service that was created for the interior routers.
- 4
- The port on which the interior routers listen for edge connections. The default is
45672
.
Create the edge routers described in the YAML file:
oc apply -f edge-routers.yaml
$ oc apply -f edge-routers.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Operator deploys an edge router on each node of the OpenShift Container Platform cluster, and connects them to the interior routers.
Verify that the edge routers were created and the Pods are running.
Each router runs in a separate Pod. Each edge router connects to any of the previously created interior routers.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3. Creating an inter-cluster router network Copier lienLien copié sur presse-papiers!
You can create a router network from routers running in different OpenShift Container Platform clusters. This enables you to connect applications running in separate clusters.
Procedure
This procedure creates router deployments in two different OpenShift Container Platform clusters (cluster1
and cluster2
) and connects them together to form an inter-cluster router network. The connection between the router deployments is secured with SSL/TLS mutual authentication.
In the first OpenShift Container Platform cluster (
cluster1
), create anInterconnect
Custom Resource YAML file that describes the interior router deployment.This example creates a single interior router with a default configuration.
Sample
cluster1-router-mesh.yaml
fileapiVersion: interconnectedcloud.github.io/v1alpha1 kind: Interconnect metadata: name: cluster1-router-mesh spec: {}
apiVersion: interconnectedcloud.github.io/v1alpha1 kind: Interconnect metadata: name: cluster1-router-mesh spec: {}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the router deployment described in the YAML file.
oc apply -f cluster1-router-mesh.yaml
$ oc apply -f cluster1-router-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The AMQ Interconnect Operator creates an interior router with a default configuration. It uses the AMQ Certificate Manager Operator to create a Certificate Authority (CA) and generate a certificate signed by the CA.
Generate an additional certificate for the router deployment in the second OpenShift Container Platform cluster (
cluster2
).The router deployment in
cluster2
requires a certificate issued by the CA ofcluster1
.Create a
Certificate
Custom Resource YAML file to request a certificate.Sample
certificate-request.yaml
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name of the Issuer that created the inter-router CA for
cluster1
. By default, the name of the Issuer is<application-name>-inter-router-ca
.
Create the certificate described in the YAML file.
oc apply -f certificate-request.yaml
$ oc apply -f certificate-request.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Extract the certificate that you generated.
mkdir /tmp/cluster2-inter-router-tls oc extract secret/cluster2-inter-router-tls --to=/tmp/cluster2-inter-router-tls
$ mkdir /tmp/cluster2-inter-router-tls $ oc extract secret/cluster2-inter-router-tls --to=/tmp/cluster2-inter-router-tls
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Log in to the second OpenShift Container Platform cluster (
cluster2
), and switch to the project where you want to create the second router deployment. In
cluster2
, create a Secret containing the certificate that you generated.oc create secret generic cluster2-inter-router-tls --from-file=/tmp/cluster2-inter-router-tls
$ oc create secret generic cluster2-inter-router-tls --from-file=/tmp/cluster2-inter-router-tls
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In
cluster2
, create anInterconnect
Custom Resource YAML file to describe the router deployment.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the router deployment described in the YAML file.
oc apply -f cluster2-router-mesh.yaml
$ oc apply -f cluster2-router-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the routers are connected.
This example displays the connections from the router in
cluster2
to the router incluster1
.oc exec cluster2-fb6bc5797-crvb6 -it -- qdstat -c
$ oc exec cluster2-fb6bc5797-crvb6 -it -- qdstat -c Connections id host container role dir security authentication tenant ==================================================================================================================================================================================================== 1 cluster1-router-mesh-port-55671-myproject.cluster1.openshift.com:443 cluster1-router-mesh-54cffd9967-9h4vq inter-router out TLSv1/SSLv3(DHE-RSA-AES256-GCM-SHA384) x.509
Copy to Clipboard Copied! Toggle word wrap Toggle overflow