Tuesday, March 12, 2019

Controladores de la replicación


Cuando necesitamos hacer escalamiento horizontal, ya sea por que un POD se nos está quedando sin recurso, necesitamos usar la característica de auto escaling de Openshift.
Para esto, se manejan los Controladores de Replicación.

$ oc autoscale dc/frontend --min 1 --max 10 --cpu-percent=80
deploymentconfig "frontend" autoscaled
Acá tenemos un ejemplo de un autoescalamiento de POD.

Mirando un Horizontal Pod Autoscaler

To view the status of a horizontal pod autoscaler:
  • Use the oc get command to view information on the CPU utilization and pod limits:
    $ oc get hpa/hpa-resource-metrics-cpu
    NAME                         REFERENCE                                 TARGET    CURRENT  MINPODS        MAXPODS    AGE
    hpa-resource-metrics-cpu     DeploymentConfig/default/frontend/scale   80%       79%      1              10         8d
    The output includes the following:
    • Target. The targeted average CPU utilization across all pods controlled by the deployment configuration.
    • Current. The current CPU utilization across all pods controlled by the deployment configuration.
    • Minpods/Maxpods. The minimum and maximum number of replicas that can be set by the autoscaler.
  • Use the oc describe command for detailed information on the horizontal pod autoscaler object.
    $ oc describe hpa/hpa-resource-metrics-cpu
    Name:                           hpa-resource-metrics-cpu
    Namespace:                      default
    Labels:                         
    CreationTimestamp:              Mon, 26 Oct 2015 21:13:47 -0400
    Reference:                      DeploymentConfig/default/frontend/scale
    Target CPU utilization:         80% 
    Current CPU utilization:        79% 
    Min replicas:                   1 
    Max replicas:                   4 
    ReplicationController pods:     1 current / 1 desired
    Conditions: 
      Type                  Status  Reason                  Message
      ----                  ------  ------                  -------
      AbleToScale           True    ReadyForNewScale        the last scale time was sufficiently old as to warrant a new scale
      ScalingActive         True    ValidMetricFound        the HPA was able to successfully calculate a replica count from pods metric http_requests
      ScalingLimited        False   DesiredWithinRange      the desired replica count is within the acceptable range
    Events:
    The average percentage of the requested memory that each pod should be using.
    The current CPU utilization across all pods controlled by the deployment configuration.
    The minimum number of replicas to scale down to.
    The maximum number of replicas to scale up to.
    If the object used the v2alpha1 API, status conditions are displayed.

No comments: