Not able to deploy functions on kubeless

438 views Asked by At

Im a beginner in Kubernetes. I have been trying out kubeless on minikube. I have set up both in the latest version available. When i deploy the function, this is the output that i got:

INFO[0000] Deploying function...                        
INFO[0000] Function hello submitted for deployment      
INFO[0000] Check the deployment status executing 'kubeless function ls hello'

When i run the kubeless function ls, i get this:

NAME    NAMESPACE   HANDLER         RUNTIME     DEPENDENCIES    STATUS                        
hello   default     example.hello   python3.6                   MISSING: Check controller logs

MISSING: Check controller logs every time i create a function it is showing this status. I also checked by changing the RUNTIME to python2.7, but still it doesn't work. The deploy command is following

kubeless function deploy hello --runtime python3.6 --from-file python-example/example.py --handler example.hello

Please guide me on how to fix this issue.

3

There are 3 answers

0
Diego Rojas On

First, get the name for the kubeless-controller pod:

kubectl -n kubeless get pods

You can get the logs from the Kubeles controller:

kubectl logs -n kubeless -c kubeless-function-controller kubeless-controller-manager-5dc8f64bb7-b9x4r
0
Nick On

As I can see from the kubeless.io:

To debug "MISSING: Check controller logs" kind of issues it is necessary to check what is the error in the controller logs. To retrieve these logs execute:

$ kubectl logs -n kubeless -l kubeless=controller

There are cases in which the validations done in the CLI won't be enough to spot a problem in the given parameters. If that is the case the function Deployment will never appear.

Hope that helps.

0
Hang Du On

From kubeless code, this status happens if kubeless cannot get status of the k8s deployment for this function.

status, err := getDeploymentStatus(cli, f.ObjectMeta.Name, f.ObjectMeta.Namespace)
                        if err != nil && k8sErrors.IsNotFound(err) {
                                status = "MISSING: Check controller logs"
                        }

So there are some possible reasons as followed:

  1. There is a runtime issue for this function, for example, syntax issue or dependency issue which cause the pod failed to run. Check the pod logs can help to figure out.(This happens for my case, not sure whether it is caused by the second reason which cause kubeless cannot get the failure message)

  2. The kubeless version is not compatible with the k8s cluster version. From k8s 1.15, the extension/v1beta1 version for deployment is removed. However, early version kubeless still uses extension/v1beta1 to get the status of deployment. You can check the api-resources of your k8s cluster.

$kubectl api-resources | grep deployments
deployments    deploy       apps      true         Deployment
#kubectl api-versions | grep apps
apps/v1

Check the following change list of kubeless which uses new apps/v1 endpoint. Use new apps/v1 endpoint

func getDeploymentStatus(cli kubernetes.Interface, funcName, ns string) (string, error) {
-   dpm, err := cli.ExtensionsV1beta1().Deployments(ns).Get(funcName, metav1.GetOptions{})
+   dpm, err := cli.AppsV1().Deployments(ns).Get(funcName, metav1.GetOptions{})