...

>

Splitting the Pod and Establishing Communication through Services

Splitting the Pod and Establishing Communication through Services

In this lesson, we will split up the Pods, create a separate DB pod and a Service to communicate with it.

Looking into the Definition

Let’s take a look at a ReplicaSet definition for a Pod with only the database.

Shell
cat svc/go-demo-2-db-rs.yml

The output is as follows.

Shell
apiVersion: apps/v1beta2
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 reduced the ...

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