Page
How to network within Red Hat OpenShift Service on AWS clusters
In this section we'll see how OSToy uses intra-cluster networking to separate functions by using microservices and visualizing the scaling of pods.
As can be seen in Figure 16, we have defined at least two separate pods, each with its own service. One is the frontend web application (with a service and a publicly accessible route); the other is the backend microservice with a service object so that the frontend pod can communicate with the microservice (across the pods if there are multiple).
Therefore this microservice is not accessible from outside this cluster, or from other namespaces/projects if configured (due to the Red Hat OpenShift Service on AWS (ROSA) network policy, ovs-networkpolicy. The sole purpose of this microservice is to serve internal web requests and return a JSON object containing the current hostname (which is the podname) and a randomly generated color string. This color string is used to display a box with that color displayed in the tile titled "Intra-cluster Communication."
What will you learn?
- Intra-cluster networking
What do you need before starting?
- Successfully deployed application on an OpenShift Service on AWS cluster
Steps for networking between functions
- Click Networking in the left menu.
- Review the networking configuration. The right tile titled "Hostname Lookup" illustrates how the service name created for a pod can be used to translate into an internal ClusterIP address.
- Enter the name of the microservice we created in the right tile ("Hostname Lookup") following the format of my-svc.my-namespace.svc.cluster.local. We created the microservice in the service definition of ostoy-microservice.yaml, which can be seen here:
apiVersion: v1
kind: Service
metadata:
name: ostoy-microservice-svc
labels:
app: ostoy-microservice
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
protocol: TCP
selector:
app: ostoy-microservice
- In this case, we will enter:
ostoy-microservice-svc.ostoy.svc.cluster.local
- This returns an IP address. In our example shown in Figure 17, it is 172.30.165.246. This is the intra-cluster IP address which is only accessible from within the cluster.
You are now ready to learn how to scale within your OpenShift Service on AWS cluster.
Get more support
- Red Hat OpenShift Service on AWS frequently asked questions
- Troubleshoot with Red Hat support
- Troubleshoot with AWS support