Just as we are not supposed to create Pods directly but using other controllers like ReplicaSet, we are not supposed to create ReplicaSets either. Kubernetes Deployments will create them for us. If you're wondering why, you'll have to wait a little while longer to find out. First, we'll create a few Deployments and, once we are familiar the process and the outcomes, it'll become obvious why they are better at managing ReplicaSets than we are.
Let's take a look at a Deployment specification for the database ReplicaSet we've been using thus far.
cat deploy/go-demo-2-db.yml
The output is as follows:
apiVersion: apps/v1beta2 kind: Deployment metadata: name: go-demo-2-db spec: selector: matchLabels: type: db service: go-demo-2 template: metadata: labels: type: db service: go-demo...