1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/deployments-replicationcontrollers.adoc
Ashley Hardin b2ceb83202 Style updates for the Applications section
Conflicts:
	modules/odc-connecting-components.adoc
2020-12-23 13:30:29 -05:00

51 lines
2.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * applications/deployments/what-deployments-are.adoc
[id="deployments-replicationcontrollers_{context}"]
= Replication controllers
A replication controller ensures that a specified number of replicas of a pod are running at all times. If pods exit or are deleted, the replication controller acts to instantiate more up to the defined number. Likewise, if there are more running than desired, it deletes as many as necessary to match the defined amount.
A replication controller configuration consists of:
* The number of replicas desired, which can be adjusted at run time.
* A `Pod` definition to use when creating a replicated pod.
* A selector for identifying managed pods.
A selector is a set of labels assigned to the pods that are managed by the replication controller. These labels are included in the `Pod` definition that the replication controller instantiates. The replication controller uses the selector to determine how many instances of the pod are already running in order to adjust as needed.
The replication controller does not perform auto-scaling based on load or traffic, as it does not track either. Rather, this requires its replica
count to be adjusted by an external auto-scaler.
The following is an example definition of a replication controller:
[source,yaml]
----
apiVersion: v1
kind: ReplicationController
metadata:
name: frontend-1
spec:
replicas: 1 <1>
selector: <2>
name: frontend
template: <3>
metadata:
labels: <4>
name: frontend <5>
spec:
containers:
- image: openshift/hello-openshift
name: helloworld
ports:
- containerPort: 8080
protocol: TCP
restartPolicy: Always
----
<1> The number of copies of the pod to run.
<2> The label selector of the pod to run.
<3> A template for the pod the controller creates.
<4> Labels on the pod should include those from the label selector.
<5> The maximum name length after expanding any parameters is 63 characters.