...

/

Splitting the Pod and Establishing Communication through Services

Splitting the Pod and Establishing Communication through Services

Learn how to split Pods, create a separate DB Pod, and a Service to communicate with it.

Looking into the definition

Let’s look at a ReplicaSet definition go-demo-2-db-rs.yml for a Pod with only the database.

Press + to interact
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: go-demo-2-db
spec:
selector:
matchLabels:
type: db
service: go-demo-2
template:
metadata:
labels:
type: db
service: go-demo-2
vendor: MongoLabs
spec:
containers:
- name: db
image: mongo:3.3
ports:
- containerPort: 28017

We’ll comment only on the things that changed.

Since this ReplicaSet defines only the database, we reduce the number of replicas to 1. We should scale MongoDB as well, but that’s out of the scope of this chapter. For now, ...

Access this course and 1400+ top-rated courses and projects.