kubeless
kubeless copied to clipboard
Pod initialization fails due to unavailable resources spec
Is this a BUG REPORT or FEATURE REQUEST?:
Kind of both.
What happened:
I have "quota restriction" in my namespace and I deployed a kubeless function using the --cpu
and --memory
flag. But the resources
spec are not getting passed to initContainers
ie., prepare
and install
but only to the main container
. Because of that the pods are not getting created.
What you expected to happen: Either of the below:
- A possible way to send the resource (request and limits) to the initContainer
- Worst case, apply the same resources to initContainers as well passed via
--cpu
and--memory
flags
How to reproduce it (as minimally and precisely as possible):
- Deploy a
ResourceQuota
to a namespace with bothrequests
andlimits
set as hard. - Deploy a function to that namespace using
kubeless function deploy
command with--cpu
and--memory
flag.
Environment:
- Kubernetes version (use
kubectl version
): 1.9 - Kubeless version (use
kubeless version
): 0.5 - Cloud provider or physical cluster: OpenShift 3.9
Hi @gkarthiks,
I agree that would be convenient to use at least the same values for the initContainers than the ones set for the runtime container. That have the disadvantage that the initContainers are more likely to have a spike in the resources consumption if it requires to compile code. Can you try to manually edit a function deployment and set the same limits than the runtime container for the init containers? Just to check if that works in your case.
@andresmgot if you mean after kubeless function deploy
, yes. That's how I am doing as of now. Patching the function deployment for the initContainers's resource deploys the pod and works as expected. IMHO, that shouldn't be the way.
Agree, we should fix that using the function spec. Thanks for confirming.
Hi @andresmgot I also tried with cronjob trigger for the function, it seems that the resources
spec are not getting passed to the job as well, and the trigger-
pod can't be created. Is it possible to apply the same function resources specs to the cronjob?
hi @hwa123,
that would be quite a different issue. The cronjob will spin up a pod that does a single curl
command to the function service so we can just hardcode some low requirements. Maybe you want to give it a try? The code is here:
https://github.com/kubeless/cronjob-trigger/blob/master/pkg/utils/kubelessutil.go#L34
I don't have time right now to work on this but I will be happy to help with any contribution.
FYI, you have to add resources to the Deployment in three places, for each init container (by hand while the feature is in the works)
create a patch
kubectl edit deployment my-function --output-patch=true
copy the JSON output (not the Patch:
part) into a patch.json, pretty the json with jq or equivalent
apply a patch
kubectl patch deployment my-function -p "$(cat patch.json)"
You can then just apply the patch on each deploy / update, as well as edit the patch itself and apply to change resource requirements. I found the Golang compile step needed more memory than I expected.
Any move on original issue?