We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Intra-Cluster DNS

The front-end of SynergyChat communicates with the api application via an external Gateway:

Domain name http://synchatapi.internal -> Gateway -> service -> pod

It's now time to connect the crawler and api applications. The api needs to be able to make HTTP requests directly to the crawler so that it can get the latest data to power the "stats" slash command.

front-end -> api -> crawler

The HTTP communication between the api and crawler is strictly internal to the cluster, there's no need for an external domain name or Gateway. That makes it simpler, faster and more secure.

Slash Command

With the tunnel open (minikube tunnel -c) open http://synchat.internal/ in your browser. Post a new message with /stats as the message text. You should see a response that says:

crawler-bot: Crawler worker not configured

That's because the api doesn't know how to communicate with the crawler yet. Let's fix that.

DNS

Kubernetes automatically creates DNS entries for each service that can be used to route HTTP traffic between services. The format is:

<service-name>.<namespace>.svc.cluster.local

Assignment

Update the api application's ConfigMap and Deployment to add a new environment variable called CRAWLER_BASE_URL its value should be:

http://<service-name>.<namespace>.svc.cluster.local

If it's not connecting, you may need to include the port:
http://<service-name>.<namespace>.svc.cluster.local:80

Replace <service-name> and <namespace> with the appropriate values for the crawler service. This will allow the api to make HTTP requests to the crawler service.

Apply your changes, restart the pod, then post a new message to SynergyChat with /stats as the message text and answer the question on the right.