You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/03/23 12:08:07 UTC

[GitHub] [camel-k] ricardo-oruspay opened a new issue #3132: Invalid replica state for HPA

ricardo-oruspay opened a new issue #3132:
URL: https://github.com/apache/camel-k/issues/3132


   Integration does not have initial state of replica required by HPA.
   
   Simple deploy:
   
   ```
   kamel run -n prod-camelk gateway.groovy                                                                                     
   Integration "gateway" created
   ```
   
   Integration OK:
   ```
   k describe it gateway -n prod-camelk
   Name:         gateway
   Namespace:    prod-camelk
   Labels:       <none>
   Annotations:  <none>
   API Version:  camel.apache.org/v1
   Kind:         Integration
   Metadata:
     Creation Timestamp:  2022-03-23T11:28:17Z
     Generation:          1
     Managed Fields:
       API Version:  camel.apache.org/v1
       Fields Type:  FieldsV1
       fieldsV1:
         f:spec:
           .:
           f:dependencies:
           f:sources:
           f:traits:
             .:
             f:container:
               .:
               f:configuration:
                 .:
                 f:requestCPU:
             f:mount:
               .:
               f:configuration:
                 .:
                 f:configs:
         f:status:
           .:
           f:capabilities:
           f:conditions:
           f:dependencies:
           f:digest:
           f:image:
           f:integrationKit:
             .:
             f:name:
             f:namespace:
           f:lastInitTimestamp:
           f:phase:
           f:platform:
           f:profile:
           f:replicas:
           f:runtimeProvider:
           f:runtimeVersion:
           f:selector:
           f:version:
       Manager:         kamel
       Operation:       Update
       Time:            2022-03-23T11:28:17Z
     Resource Version:  320716511
     Self Link:         /apis/camel.apache.org/v1/namespaces/prod-camelk/integrations/gateway
     UID:               503de9bd-7304-4338-8f35-3681ccb5f8b5
   Spec:
     Dependencies:
       camel:jackson
       camel:http
     Sources:
       Content:  ...
       Name:  gateway.groovy
     Traits:
       Container:
         Configuration:
           Request CPU:  50ms
       Mount:
         Configuration:
           Configs:
             configmap:gateway-config
   Status:
     Capabilities:
       rest
     Conditions:
       First Truthy Time:     2022-03-23T11:28:17Z
       Last Transition Time:  2022-03-23T11:28:17Z
       Last Update Time:      2022-03-23T11:28:17Z
       Message:               prod-camelk/camel-k
       Reason:                IntegrationPlatformAvailable
       Status:                True
       Type:                  IntegrationPlatformAvailable
       First Truthy Time:     2022-03-23T11:28:17Z
       Last Transition Time:  2022-03-23T11:28:17Z
       Last Update Time:      2022-03-23T11:28:17Z
       Message:               kit-c8su28hts5e0i2othlgg
       Reason:                IntegrationKitAvailable
       Status:                True
       Type:                  IntegrationKitAvailable
       Last Transition Time:  2022-03-23T11:28:17Z
       Last Update Time:      2022-03-23T11:28:17Z
       Message:               different controller strategy used (deployment)
       Reason:                CronJobNotAvailableReason
       Status:                False
       Type:                  CronJobAvailable
       First Truthy Time:     2022-03-23T11:28:17Z
       Last Transition Time:  2022-03-23T11:28:17Z
       Last Update Time:      2022-03-23T11:28:17Z
       Message:               deployment name is gateway
       Reason:                DeploymentAvailable
       Status:                True
       Type:                  DeploymentAvailable
       First Truthy Time:     2022-03-23T11:28:17Z
       Last Transition Time:  2022-03-23T11:28:17Z
       Last Update Time:      2022-03-23T11:28:17Z
       Message:               gateway(http/80) -> integration(http/8080)
       Reason:                ServiceAvailable
       Status:                True
       Type:                  ServiceAvailable
       Last Transition Time:  2022-03-23T11:28:17Z
       Last Update Time:      2022-03-23T11:28:17Z
       Message:               no host or service defined
       Reason:                IngressNotAvailable
       Status:                False
       Type:                  ExposureAvailable
       First Truthy Time:     2022-03-23T11:28:19Z
       Last Transition Time:  2022-03-23T11:28:19Z
       Last Update Time:      2022-03-23T11:28:19Z
       Message:               1/1 ready replicas
       Reason:                DeploymentReady
       Status:                True
       Type:                  Ready
     Dependencies:
       camel:http
       camel:jackson
       mvn:org.apache.camel.k:camel-k-runtime
       mvn:org.apache.camel.quarkus:camel-quarkus-groovy-dsl
       mvn:org.apache.camel.quarkus:camel-quarkus-platform-http
       mvn:org.apache.camel.quarkus:camel-quarkus-rest
     Digest:  vQLk6v_KmBpskZftDXC4pi4OMyy7vJPBoylWqmY_2u9E
     Image:   .../camel-k-kit-c8su28hts5e0i2othlgg@sha256:bc22a992c7c9345bb7be83feae553d4c18805498cfc3915a8918a81032b662a7
     Integration Kit:
       Name:               kit-c8su28hts5e0i2othlgg
       Namespace:          prod-camelk
     Last Init Timestamp:  2022-03-23T11:28:17Z
     Phase:                Running
     Platform:             camel-k
     Profile:              Kubernetes
     Replicas:             1
     Runtime Provider:     quarkus
     Runtime Version:      1.12.0
     Selector:             camel.apache.org/integration=gateway
     Version:              1.8.2
   Events:
     Type    Reason                       Age                    From                            Message
     ----    ------                       ----                   ----                            -------
     Normal  IntegrationConditionChanged  2m39s                  camel-k-integration-controller  Condition "IntegrationPlatformAvailable" is "True" for Integration gateway: prod-camelk/camel-k
     Normal  IntegrationPhaseUpdated      2m39s                  camel-k-integration-controller  Integration "gateway" in phase "Initialization"
     Normal  IntegrationPhaseUpdated      2m39s                  camel-k-integration-controller  Integration "gateway" in phase "Building Kit"
     Normal  IntegrationConditionChanged  2m39s                  camel-k-integration-controller  Condition "IntegrationKitAvailable" is "True" for Integration gateway: kit-c8su28hts5e0i2othlgg
     Normal  IntegrationPhaseUpdated      2m39s                  camel-k-integration-controller  Integration "gateway" in phase "Deploying"
     Normal  IntegrationConditionChanged  2m39s (x2 over 2m39s)  camel-k-integration-controller  Condition "CronJobAvailable" is "False" for Integration gateway: different controller strategy used (deployment)
     Normal  IntegrationConditionChanged  2m39s (x2 over 2m39s)  camel-k-integration-controller  Condition "DeploymentAvailable" is "True" for Integration gateway: deployment name is gateway
     Normal  IntegrationConditionChanged  2m39s (x2 over 2m39s)  camel-k-integration-controller  Condition "ServiceAvailable" is "True" for Integration gateway: gateway(http/80) -> integration(http/8080)
     Normal  IntegrationConditionChanged  2m39s (x2 over 2m39s)  camel-k-integration-controller  Condition "ExposureAvailable" is "False" for Integration gateway: no host or service defined
     Normal  IntegrationConditionChanged  2m39s (x2 over 2m39s)  camel-k-integration-controller  Condition "Ready" is "False" for Integration gateway: 0/1 updated replicas
     Normal  IntegrationPhaseUpdated      2m39s (x2 over 2m39s)  camel-k-integration-controller  Integration "gateway" in phase "Running"
     Normal  IntegrationConditionChanged  2m38s (x2 over 2m38s)  camel-k-integration-controller  Condition "Ready" is "False" for Integration gateway: 0/1 ready replicas
     Normal  IntegrationConditionChanged  2m37s (x2 over 2m37s)  camel-k-integration-controller  Condition "Ready" is "True" for Integration gateway: 1/1 ready replicas
   
   ```
   
   HPA spec:
   ```
   apiVersion: autoscaling/v2beta2
   kind: HorizontalPodAutoscaler
   metadata:
     name: gateway-autoscale
     namespace: prod-camelk
   spec:
     scaleTargetRef:
       apiVersion: camel.apache.org/v1
       kind: Integration
       name: gateway
     minReplicas: 3
     maxReplicas: 3
     metrics:
     - type: Resource
       resource:
         name: cpu
         target:
           type: Utilization
           averageUtilization: 80
   
   ```
   
   HPA can not find replicas field:
   ```
   
   k describe hpa gateway-autoscale -n prod-camelk
   Name:                                                  gateway-autoscale
   Namespace:                                             prod-camelk
   Labels:                                                <none>
   Annotations:                                           <none>
   CreationTimestamp:                                     Wed, 23 Mar 2022 08:37:22 -0300
   Reference:                                             Integration/gateway
   Metrics:                                               ( current / target )
     resource cpu on pods  (as a percentage of request):  <unknown> / 80%
   Min replicas:                                          3
   Max replicas:                                          3
   Integration pods:                                      0 current / 0 desired
   Conditions:
     Type         Status  Reason          Message
     ----         ------  ------          -------
     AbleToScale  False   FailedGetScale  the HPA controller was unable to get the target's current scale: Internal error occurred: the spec replicas field ".spec.replicas" does not exist
   Events:
     Type     Reason          Age   From                       Message
     ----     ------          ----  ----                       -------
     Warning  FailedGetScale  13s   horizontal-pod-autoscaler  Internal error occurred: the spec replicas field ".spec.replicas" does not exist
   
   ```
   
   The workaround is force any scale:
   ```
   kubectl scale it gateway -n prod-camelk --replicas 1                                                                        
   integration.camel.apache.org/gateway scaled
   ```
   
   Then HPA start working:
   ```
   k describe hpa gateway-autoscale -n prod-camelk                                                                             
   Name:                                                  gateway-autoscale
   Namespace:                                             prod-camelk
   Labels:                                                <none>
   Annotations:                                           <none>
   CreationTimestamp:                                     Wed, 23 Mar 2022 09:03:54 -0300
   Reference:                                             Integration/gateway
   Metrics:                                               ( current / target )
     resource cpu on pods  (as a percentage of request):  <unknown> / 80%
   Min replicas:                                          3
   Max replicas:                                          3
   Integration pods:                                      3 current / 3 desired
   Conditions:
     Type           Status  Reason                   Message
     ----           ------  ------                   -------
     AbleToScale    True    SucceededGetScale        the HPA controller was able to get the target's current scale
   Events:
     Type     Reason                        Age               From                       Message
     ----     ------                        ----              ----                       -------
     Normal   SuccessfulRescale             32s               horizontal-pod-autoscaler  New size: 3; reason: Current number of replicas below Spec.MinReplicas
   
   ```
   
   Version: Camel K 1.8.2


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org