Uploaded image for project: 'Knative Serving'
  1. Knative Serving
  2. SRVKS-547

KnativeServing doesn't respect LimitRange defaultRequest

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • 1.7.0
    • None
    • Serverless Sprint 184, Serverless Sprint 185

      Having a LimitRange defined in a namespace

      apiVersion: "v1"
      kind: "LimitRange"
      metadata:
        name: "core-resource-limits" 
      spec:
        limits:
          - type: "Pod"
            max:
              cpu: "2" 
              memory: "1Gi" 
            min:
              cpu: "200m" 
              memory: "6Mi" 
          - type: "Container"
            max:
              cpu: "2" 
              memory: "1Gi" 
            min:
              cpu: "100m" 
              memory: "4Mi" 
            default:
              cpu: "300m" 
              memory: "200Mi" 
            defaultRequest:
              cpu: "200m" 
              memory: "100Mi" 
            maxLimitRequestRatio:
              cpu: "10" 
      

      It is possible to create a pod without specifying resource requests there

      apiVersion: v1
      kind: Pod
      metadata:
        name: helloworld-go
        labels:
          app: helloworld-go
      spec:
        containers:
          - image: gcr.io/knative-samples/helloworld-go
            name: helloworld-go
            env:
            - name: TARGET
              value: "Go Sample v1"
      

      but the same deployed as a ksvc doesn't work:

      apiVersion: serving.knative.dev/v1
      kind: Service
      metadata:
        name: helloworld-go
      spec:
        template:
          spec:
            containers:
            - image: gcr.io/knative-samples/helloworld-go
              env:
              - name: TARGET
                value: "Go Sample v1"
      

      Will not be deployed with errors:

      1s          Warning   FailedCreate        replicaset/helloworld-go-xx9rh-deployment-745cd6876f   (combined from similar events): Error creating: pods "helloworld-go-xx9rh-deployment-745cd6876f-kpbmx" is forbidden: [minimum cpu usage per Container is 100m, but request is 25m, cpu max limit to request ratio per Container is 10, but provided ratio is 12.000000]
      

            [SRVKS-547] KnativeServing doesn't respect LimitRange defaultRequest

            Closing this ticket as I have already opened doc request in SRVKS-574.
             

            Kenjiro Nakayama (Inactive) added a comment - Closing this ticket as I have already opened doc request in SRVKS-574 .  

            If there's no sensible workaround now, that works for me.

            Markus Thömmes (Inactive) added a comment - If there's no sensible workaround now, that works for me.

            maschmid@redhat.com bbrownin@redhat.com markusthoemmes
            Is it alright to document this as a known limitation until https://github.com/knative/serving/issues/8012 is addressed in upstream?

            Kenjiro Nakayama (Inactive) added a comment - maschmid@redhat.com bbrownin@redhat.com markusthoemmes Is it alright to document this as a known limitation until https://github.com/knative/serving/issues/8012 is addressed in upstream?

            IIUC, the default value 25m, which caused the error, is from queue-proxy and the default does respect neither config-defaults.yaml nor LimitRange/ReqsourceQuotas but just from fixed value in the code

            We most probably need to wait for this upstream's proposal https://github.com/knative/serving/issues/8012

            Kenjiro Nakayama (Inactive) added a comment - IIUC, the default value 25m, which caused the error, is from queue-proxy and the default does respect neither config-defaults.yaml nor LimitRange/ReqsourceQuotas but just from fixed value in the code We most probably need to wait for this upstream's proposal https://github.com/knative/serving/issues/8012

            maschmid@redhat.com Having just gone through this with another cluster / user, we probably should document things. Do you have a default resource request/limit set for your Knative Serving install? How are you installing Serving on this cluster? If done via our operator, ensure you aren't setting resource request/limits in spec.config.defaults if you're trying to use LimitRanges. If you don't set defaults for Knative Serving itself, the defaults from LimitRanges should get used.

            Ben Browning added a comment - maschmid@redhat.com Having just gone through this with another cluster / user, we probably should document things. Do you have a default resource request/limit set for your Knative Serving install? How are you installing Serving on this cluster? If done via our operator, ensure you aren't setting resource request/limits in spec.config.defaults if you're trying to use LimitRanges. If you don't set defaults for Knative Serving itself, the defaults from LimitRanges should get used.

            I wonder that the Serving pod should respect the LimitRange if it is defined. The current solution is a little bit troublesome. We need to configure the default limits on every single Ksvc or ask admins to decrease the minimum limit.

            It may be better to bring this discussion on upstream? (Although it seems not an easy code change...)

            Kenjiro Nakayama (Inactive) added a comment - I wonder that the Serving pod should respect the LimitRange if it is defined. The current solution is a little bit troublesome. We need to configure the default limits on every single Ksvc or ask admins to decrease the minimum limit. It may be better to bring this discussion on upstream? (Although it seems not an easy code change...)

            Should we document how to do that then?

            Marek Schmidt added a comment - Should we document how to do that then?

            I have successfully used LimitRanges with Knative Serving. In this specific case, the problem is Knative is specifying a request of 25m when creating your pod because that must be the value configured in your Knative Serving install. And that 25m value is below your minimum allowed of 100m.

            If you're going to set a minimum LimitRange value for CPU or memory, you'll need to configure Knative to not try to set values below that minimum by default.

            Ben Browning added a comment - I have successfully used LimitRanges with Knative Serving. In this specific case, the problem is Knative is specifying a request of 25m when creating your pod because that must be the value configured in your Knative Serving install. And that 25m value is below your minimum allowed of 100m. If you're going to set a minimum LimitRange value for CPU or memory, you'll need to configure Knative to not try to set values below that minimum by default.

              rhn-support-knakayam Kenjiro Nakayama (Inactive)
              maschmid@redhat.com Marek Schmidt
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: