ReplicaSets - recap Flashcards

1
Q

What is a ReplicaSet

A
  • runs multiple instance of a single pod
  • provides high availability
  • automates bringing up a single pod
  • helps with load balancing and scaling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What’s the difference between a ReplicaSet and Replication Controller

A
  • Similar purpose
  • Replication Controller is the older approach and ReplicaSet is newer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do I create a replication controller

A
  • Create a yaml file with the required fields
  • kind: ReplicationController
  • spec must include template section
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does template do in YAML config

A

Tells the ReplicationController how to create more pods with those specifications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do I create a ReplicaSet

A
  • Create a YAML definition
  • apiVersion must be apps/v1
  • kind must be ReplicaSet
  • spec > template (same as replication controller)
  • replicas: number of desired replicas
  • selector: helps ReplicaSet identify what pods fall under its control
  • matchLabel: matches labels to the ones on the pod template
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why do we need a “selector” in the ReplicaSet YAML definition

A

Because ReplicaSets can manage pods not created as part of the ReplicaSet (e.g., pods created before the ReplicaSet but which fall under the same selector label)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which labels have to match in the ReplicaSet YAML definition

A

select > matchLabels > tier
must match
template > metadata > labels > tier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do I scale ReplicaSets

A
  • Update the replicas field
  • $ k scale –replicas=<number> -f <yaml></yaml></number>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Does running $ k scale <etc> change the YAML definition file</etc>

A

No. You must also:
* update the yaml
* $ k delete replicaset <name>
* $ k replace 0f <updated></updated></name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly