Creating ReplicaSets
Learn how to create and retrieve a ReplicaSet.
We'll cover the following...
Definition
Let’s look at a ReplicaSet named go-demo-2.yml
based on the Pod we created in the previous chapter:
Press + to interact
apiVersion: apps/v1kind: ReplicaSetmetadata:name: go-demo-2spec:replicas: 2selector:matchLabels:type: backendservice: go-demo-2template:metadata:labels:type: backendservice: go-demo-2db: mongolanguage: gospec:containers:- name: dbimage: mongo:3.3- name: apiimage: vfarcic/go-demo-2env:- name: DBvalue: localhostlivenessProbe:httpGet:path: /demo/helloport: 8080
Note: The
apiVersion
,kind
, andmetadata
fields are mandatory with all Kubernetes objects. ReplicaSet is no exception because it’s also a Kubernetes object.
-
Line 1: We specify that the
apiVersion
isapps/v1
. -
Lines 2–3: The
kind
isReplicaSet
andmetadata
has thename
key set to ...
Access this course and 1400+ top-rated courses and projects.