Creating ReplicaSets
In this lesson, first, we will create a ReplicaSet and then retrieve it.
Looking into the Definition
Let’s take a look at a ReplicaSet based on the Pod we created in the previous chapter.
The output is as follows.
The
apiVersion,kind, andmetadatafields are mandatory with all Kubernetes objects. ReplicaSet is no exception, i.e., it is also a Kubernetes object.
-
Line 1: We specified that the
apiVersionisapps/v1beta2. At the time of this writing, ReplicaSet is still in beta. Soon it will be considered stable, and you’ll be able to replace the value withapps/v1. -
Line 2-3: The
kindisReplicaSetandmetadatahas thenamekey set togo-demo-2. We could have extended ReplicaSetmetadatawith labels. However, we skipped that part since they would serve only for informational purposes. They do not affect the behavior of the ReplicaSet.
You should be familiar with the above three fields since we already explored them when we worked with Pods. In addition to them, the spec section is mandatory as well.
-
Line 5-6: The first ...