

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 7
click for more info
Not enough gems
Cost: 6 gems
1: Namespaces
incomplete
2: Moving Namespaces
incomplete
3: Intra-Cluster DNS
incomplete
4: Namespace and Routing Review
incomplete
This lesson's interactive features are locked, please to keep using them
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.
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.
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
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.