Creating the Split API Pods
In this lesson, we will create API Pods using ReplicaSet and establish communication by creating Service.
Looking into the Definition
Moving to the backend API…
The output is as follows.
Just as with the database, this ReplicaSet should be familiar since it’s very similar to the one we used before. We’ll comment only on the differences.
-
Line 6: The number of
replicasis set to3. That solves one of the main problems we had with the previous ReplicaSets that defined Pods with both containers. Now the number of replicas can differ, and we have one Pod for the database, and three for the backend API. -
Line 14: In the
labelssection,typelabel is set toapiso that both the ReplicaSet and the (soon to come) Service can distinguish the Pods from those created for the database. -
Line 22-23: We have the environment variable
DBset togo-demo-2-db. The code behind thevfarcic/go-demo-2image is written in a way that the ...