4 - Replication Controllers and ReplicaSets Flashcards

1
Q

What are controllers and what are their types in Kubernetes?

A

Controllers are the brain of Kubernetes, they are the processes that monitor objects and respond accordingly.

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

What is a replica and why do we need a replica controller?

A

In a scenario where we have a single pod with the instance of our application, if that pod goes down, our application will be unavailable.
The replica is one or more pods containing our application running at the same time.
The replication controller helps us to run several pods of the application and ensures high availability.

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

How is a replication controller configuration file defined?

A

apiVersion: v1

kind: ReplicationController

metadata:
  name: myapp-rc
  labels:
     app: myapp
     type: front-end
spec:
  template:
      metadata:
          name: nginx
          labels:
            app: myapp
            type: front-end
      spec:
         containers:
             - name: nginx
               image: nginx
  replicas: 3
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which command is used to create a replica controller using a file?

A

kubectl create -f arquivo.yml

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

Which command is used to view the replication controllers?

A

kubectl get replicationcontroller

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

How can I increase the number of pods running on a replication controller?

A

1) Changing the definition file and run the command kubectl replace -f file.yaml
2) kubectl scale –replicas = 6 -f file.yaml
3) kubectl scale –replicas = 6 replicaset myapp-replicaset
4) kubectl edit -f file.yaml

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

How is a replication set configuration file defined?

A

apiVersion: v1

kind: ReplicationController

metadata:
  name: myapp-rc
  labels:
     app: myapp
     type: front-end
spec:
  template:
      metadata:
          name: nginx
          labels:
            app: myapp
            type: front-end
      spec:
         containers:
             - name: nginx
               image: nginx
  replicas: 3
  selector:
     matchLabels:
        type: front-end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly