4 - Replication Controllers and ReplicaSets Flashcards
What are controllers and what are their types in Kubernetes?
Controllers are the brain of Kubernetes, they are the processes that monitor objects and respond accordingly.
- Replica Controllers
- Replica Sets
What is a replica and why do we need a replica controller?
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 is a replication controller configuration file defined?
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
Which command is used to create a replica controller using a file?
kubectl create -f arquivo.yml
Which command is used to view the replication controllers?
kubectl get replicationcontroller
How can I increase the number of pods running on a replication controller?
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 is a replication set configuration file defined?
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