Closed vishweshwarp closed 6 years ago
This issue is blocking us from deploying actual application Functions where multiple dependencies are defined.
Hello @vishweshwarp Unfortunately, some of our team are taking a couple of days off and I am unable to correctly answer to your issue.
Our team will take a look at it shortly. Please bear with us
@vishweshwarp Sorry for the delayed response. We just got back to work on this week and catch up a bit after new year holiday.
I am not seeing any error in your logs. May I know the kubeless version you are using and kubernetes environment you are running it on ? Are you sure to wait long enough and the pod still stuck at Init state. The problem might came from network issue or resource insufficiency
I am now using Kubeless 0.3.3, Kubernetes 1.8.4 with RBAC. I installed Kubeless using RBAC yaml https://github.com/kubeless/kubeless/releases/download/v0.3.3/kubeless-rbac-v0.3.3.yaml
Yes I waited more than 2 hours.
Here are the kube controller logs
root@vishu-dev-vm:/workspace/devops-insight/functions/mongo-utils# kubectl logs kubeless-controller-5957f7b87d-jqz6q -n kubeless
time="2018-01-04T10:56:57Z" level=info msg="Starting kubeless controller" pkg=controller
time="2018-01-04T10:56:57Z" level=info msg="Kubeless controller synced and ready" pkg=controller
time="2018-01-04T11:07:17Z" level=info msg="Processing change to Function default/mongo-connect" pkg=controller
time="2018-01-04T11:07:17Z" level=error msg="Function can not be created/updated: servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:17Z" level=error msg="Error processing default/mongo-connect (will retry): servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:17Z" level=info msg="Processing change to Function default/mongo-connect" pkg=controller
time="2018-01-04T11:07:17Z" level=error msg="Function can not be created/updated: servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:17Z" level=error msg="Error processing default/mongo-connect (will retry): servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:17Z" level=info msg="Processing change to Function default/mongo-connect" pkg=controller
time="2018-01-04T11:07:19Z" level=error msg="Function can not be created/updated: servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:19Z" level=error msg="Error processing default/mongo-connect (will retry): servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:19Z" level=info msg="Processing change to Function default/mongo-connect" pkg=controller
time="2018-01-04T11:07:21Z" level=error msg="Function can not be created/updated: servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:21Z" level=error msg="Error processing default/mongo-connect (will retry): servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:21Z" level=info msg="Processing change to Function default/mongo-connect" pkg=controller
time="2018-01-04T11:07:23Z" level=error msg="Function can not be created/updated: servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:23Z" level=error msg="Error processing default/mongo-connect (will retry): servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:23Z" level=info msg="Processing change to Function default/mongo-connect" pkg=controller
time="2018-01-04T11:07:25Z" level=error msg="Function can not be created/updated: servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
time="2018-01-04T11:07:25Z" level=error msg="Error processing default/mongo-connect (giving up): servicemonitors.monitoring.coreos.com \"mongo-connect\" is forbidden: User \"system:serviceaccount:kubeless:controller-acct\" cannot delete servicemonitors.monitoring.coreos.com in the namespace \"default\"" pkg=controller
E0104 11:07:25.214721 1 controller.go:171] servicemonitors.monitoring.coreos.com "mongo-connect" is forbidden: User "system:serviceaccount:kubeless:controller-acct" cannot delete servicemonitors.monitoring.coreos.com in the namespace "default"
I guess you are running prometheus-operator. From your info, I can see the dependency doesn't cause problem and in fact it run success. The controller log shows that function pod can't start up because it creates servicemonitor mongo-connect
which is not relevant to kubeless btw.
If you look into our manifest, you will see the kubeless-controller is running under service account controller-acct
which is assigning the clusterrole kubeless-controller-deployer
. So can you work around this issue by adding to the clusterrole kubeless-controller-deployer
the proper actions for servicemonitors resource ?
Hi @vishweshwarp,
Actually the error entry in the controller should not affect the deployment (since monitoring is handled at the very end).
My guess is that the initContainer does not have access to the internet or pypi.python.org
so the connection hangs. In which platform/cloud provider are you running your example? What are the logs of the initContainer? You can retrieve them executing:
kubectl logs mongo-connect-7dfb4868f-crt96 -c prepare
Also note that you don't need the serverless-python-requirements
plugin, that one is not used with Kubeless, we handle the installation so your serverless.yaml should look something like:
service: mongo-utils
provider:
name: kubeless
runtime: python2.7
plugins:
- serverless-kubeless
functions:
mongo-connect:
handler: handler.mongoConnect
@andresmgot init container has access to internet but I noticed a problem with pod network which is causing kube-dns restart each time function pod tries to resolve python depenencies. After I solved network issue, function pod came up successfully.
If we use requirements.txt with dependencies defined in it, 'serverless deploy' gets stuck with pod at Init state.
Dependency mentioned in requirements.txt is not even used in my handler.py. And if I just delete requirements.txt file from service folder, everything starts working, function gets deployed without any issues.
mongo-connect-7dfb4868f-crt96 0/1 Init:CrashLoopBackOff 4 5m
handler.py
requirements.txt
pymongo==2.7
serverless.yml
Serverless Commands:
Pod logs:
Function pod describe: