1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 15:46:57 +01:00
Files
openshift-docs/modules/deployments-replicationcontrollers.adoc

59 lines
2.0 KiB
Plaintext
Raw Normal View History

2019-02-08 16:46:08 -05:00
// Module included in the following assemblies:
//
2019-02-19 14:25:06 -05:00
// * applications/deployments/what-deployments-are.adoc
2019-02-08 16:46:08 -05:00
2019-05-13 08:55:00 +10:00
[id="deployments-replicationcontrollers_{context}"]
2019-02-08 16:46:08 -05:00
= ReplicationControllers
A ReplicationController ensures that a specified number of replicas of a pod are running at
all times. If pods exit or are deleted, the ReplicationController acts to
2019-02-08 16:46:08 -05:00
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 ReplicationController configuration consists of:
* The number of replicas desired (which can be adjusted at runtime).
* A `Pod` definition to use when creating a replicated pod.
* A selector for identifying managed pods.
2019-02-08 16:46:08 -05:00
A selector is a set of labels assigned to
the pods that are managed by the ReplicationController. These labels are
included in the `Pod` definition that the ReplicationController instantiates.
2019-02-08 16:46:08 -05:00
The ReplicationController uses the selector to determine how many
instances of the pod are already running in order to adjust as needed.
2019-02-08 16:46:08 -05:00
The ReplicationController 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 ReplicationController:
[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.
2019-02-08 16:46:08 -05:00
<5> The maximum name length after expanding any parameters is 63 characters.