Skip to content

ResourceQuota error isn't reflected in kservice status #4416

Open

Description

@juliaguo

In what area(s)?

/area API

What version of Knative?

HEAD

Expected Behavior

Default namespace contains a LimitRange that limits defaultRequest CPU to 100m. Created a ResourceQuota in the same namespace with CPU quota set to 50m. Tried to serve requests to an app deployed in the same namespace. Expected to see an error message when running kubectl get kservice or kubectl get pods saying that there was a failure since the resourcequota was exceeded.

Actual Behavior

Cannot hit the service (loading is stuck). kubectl get kservice shows the app as Ready, with no mention of the quota error in the status. No mention of pod creation failure. Only digging further down and looking at the yaml of the deployment shows the error.

Status of kservice:

status:
  address:
    hostname: testapp.default.svc.cluster.local
    url: http://testapp.default.svc.cluster.local
  conditions:
  - lastTransitionTime: 2019-05-09T23:14:18Z
    status: "True"
    type: ConfigurationsReady
  - lastTransitionTime: 2019-06-17T17:12:57Z
    message: build cannot be migrated forward.
    reason: build
    severity: Warning
    status: "False"
    type: Convertible
  - lastTransitionTime: 2019-05-09T23:14:19Z
    status: "True"
    type: Ready
  - lastTransitionTime: 2019-05-09T23:14:19Z
    status: "True"
    type: RoutesReady
  domain: testapp.default.example.com
  domainInternal: testapp.default.svc.cluster.local
  latestCreatedRevisionName: testapp-ncngm
  latestReadyRevisionName: testapp-ncngm
  observedGeneration: 1
  traffic:
  - latestRevision: true
    percent: 100
    revisionName: testapp-ncngm
  url: http://testapp.default.example.com

Status of deployment:

status:
  conditions:
  - lastTransitionTime: 2019-05-09T23:14:08Z
    lastUpdateTime: 2019-06-17T17:13:02Z
    message: ReplicaSet "testapp-ncngm-deployment-6cbf59d7b9" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  - lastTransitionTime: 2019-06-18T22:06:36Z
    lastUpdateTime: 2019-06-18T22:06:36Z
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: "False"
    type: Available
  - lastTransitionTime: 2019-06-18T22:06:36Z
    lastUpdateTime: 2019-06-18T22:06:36Z
    message: 'pods "testapp-ncngm-deployment-6cbf59d7b9-cjrjl" is forbidden: exceeded
      quota: new-cpu-quota, requested: cpu=225m, used: cpu=200m, limited: cpu=50m'
    reason: FailedCreate
    status: "True"
    type: ReplicaFailure
  observedGeneration: 6
  unavailableReplicas: 1

Steps to Reproduce the Problem

  1. Create a limit range in a namespace, setting the default CPU (or any resource) to a value.
  2. Create ResourceQuota in the same namespace, setting the quota for the resource to a smaller value than the default.
  3. Try to serve requests from an app in the same namespace.

I believe the issue might be related to how the deployment is being reconciled. It looks like there is an "Error getting pods" message that is getting logged but the status of the revision/kservice do not get updated. Also the logic is checking that deployment.Status.AvailableReplicas == 0, which might not match all cases where pod creation has failed (for example, if 2 replicas have already been created, and the 3rd replica exceeds the ResourceQuota limit). Would it be possible to use the UnavailableReplicas value in the deployment instead?

Code for reference: https://github.com/knative/serving/blob/master//pkg/reconciler/revision/reconcile_resources.go#L36:22

Activity

  1. added
    kind/bug
    on Jun 18, 2019
  2. added this to the Serving 0.8 milestone on Jun 20, 2019
  3. added
    area/API
    on Jun 20, 2019
  4. dgerd commented on Jun 20, 2019

    @dgerd

    Thanks for the bug report. This looks like something that we should bubble up into the Service status.

    Added API label and moved into Serving 0.8.

  5. dprotaso commented on Jul 20, 2020

    @dprotaso
    Member
  6. knative-prow-robot commented on Jul 20, 2020

    @knative-prow-robot
    Contributor

    @dprotaso: Reopened this issue.

    Details

    In response to this:

    /reopen

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

  7. jonjohnsonjr commented on Jul 21, 2020

    @jonjohnsonjr
    Contributor

    /unassign

  8. 55 remaining items

  9. xiangpingjiang commented on Aug 23, 2023

    @xiangpingjiang
    Contributor

    /assign

  10. removed their assignment
    on Aug 23, 2023
  11. houshengbo commented on Aug 23, 2023

    @houshengbo

    /assign @xiangpingjiang Are you going to take over this issue?

  12. xiangpingjiang commented on Aug 24, 2023

    @xiangpingjiang
    Contributor

    @houshengbo yes, I want have a try

  13. xiangpingjiang commented on Aug 27, 2023

    @xiangpingjiang
    Contributor

    /assign

  14. removed their assignment
    on Sep 29, 2023
  15. husnialhamdani commented on Sep 29, 2023

    @husnialhamdani

    /assign

  16. gabo1208 commented on Oct 16, 2023

    @gabo1208
    Contributor

    Probably fixed here: #14453
    I'm testing to see if it's true

    It does bubbles up the quota limit errors, too. I'm adding this as fixed issue to the PR

  17. dprotaso commented on Dec 5, 2023

    @dprotaso
    Member

    @gabo1208 were you able to follow up if your changes fixes this issue?

  18. gabo1208 commented on Dec 6, 2023

    @gabo1208
    Contributor

    Let me test between today and Friday this exact case, but should be fixed, I'll update the issue with the results @dprotaso

  19. gabo1208 commented on Dec 6, 2023

    @gabo1208
    Contributor

    Using a limit range:
    Screenshot from 2023-12-06 17-24-06

    with this service:

    kn service create $NAME --image gcr.io/knative-samples/helloworld-go --request cpu=1m --limit cpu=1
    

    yields this:

    Creating service 'test-23735' in namespace 'default':
    
      3.291s The Route is still working to reflect the latest desired specification.
      3.298s Configuration "test-23735" is waiting for a Revision to become ready.
      3.870s Revision "test-23735-00001" failed with message: pods "test-23735-00001-deployment-c885bfff-7vf77" is forbidden: minimum cpu usage per Container is 10m, but request is 1m.
      3.891s Configuration "test-23735" does not have any ready Revision.
    Error: RevisionFailed: Revision "test-23735-00001" failed with message: pods "test-23735-00001-deployment-c885bfff-7vf77" is forbidden: minimum cpu usage per Container is 10m, but request is 1m.
    
    Revision status:
     - lastTransitionTime: "2023-12-06T16:26:00Z"
        message: 'pods "test-23735-00001-deployment-c885bfff-7vf77" is forbidden: minimum
          cpu usage per Container is 10m, but request is 1m'
        reason: FailedCreate
        status: "False"
        type: ResourcesAvailable
    
    So yep I think we can close this one cc @dprotaso :)
    
  20. skonto commented on Nov 1, 2024

    @skonto
    Contributor

    @dprotaso should I close this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/APIgood first issuehelp wantedkind/bugtriage/accepted

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions