Before we dive into services, we should create a ReplicaSet similar to the one we used in the previous chapter. It'll provide the Pods we can use to demonstrate how Services work.
Let's take a quick look at the ReplicaSet definition:
cat svc/go-demo-2-rs.yml
The only significant difference is the db container definition. It is as follows.
... - name: db image: mongo:3.3 command: ["mongod"] args: ["--rest", "--httpinterface"] ports: - containerPort: 28017 protocol: TCP ...
We customized the command and the arguments so that MongoDB exposes the REST interface. We also defined the containerPort. Those additions are needed so that we can test that the database is accessible through the Service.
Let's create the ReplicaSet:
kubectl create -f svc/go-demo-2-rs.yml kubectl get -f svc...