serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 80 forks source link

Can't get example working on minikube. #177

Closed Industrial closed 5 years ago

Industrial commented 5 years ago
๐Ÿ˜„  minikube v1.0.0 on linux (amd64)
๐Ÿคน  Downloading Kubernetes v1.14.0 images in the background ...
๐Ÿ’ก  Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
๐Ÿ”„  Restarting existing virtualbox VM for "minikube" ...
โŒ›  Waiting for SSH access ...
๐Ÿ“ถ  "minikube" IP address is 192.168.99.100
๐Ÿณ  Configuring Docker as the container runtime ...
๐Ÿณ  Version of container runtime is 18.06.2-ce
โŒ›  Waiting for image downloads to complete ...
โœจ  Preparing Kubernetes environment ...
๐Ÿšœ  Pulling images required by Kubernetes v1.14.0 ...
๐Ÿ”„  Relaunching Kubernetes v1.14.0 using kubeadm ...
โŒ›  Waiting for pods: apiserver proxy etcd scheduler controller dns
๐Ÿ“ฏ  Updating kube-proxy configuration ...
๐Ÿค”  Verifying component health ......
๐Ÿ’—  kubectl is now configured to use "minikube"
๐Ÿ„  Done! Thank you for using minikube!

Whereafter:

Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command info
Serverless: Load command logs
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Packaging service...
Serverless: Excluding development dependencies...
/home/tom/Code/Code9/JavaScript/Projects/test-next.js/services/api-serverless/node_modules/serverless-kubeless/lib/config.js:56
      return JSON.parse(this.configMag.data[key]);
                                           ^

TypeError: Cannot read property 'runtime-images' of undefined
    at Config.get (/home/tom/Code/Code9/JavaScript/Projects/test-next.js/services/api-serverless/node_modules/serverless-kubeless/lib/config.js:56:44)
    at Object.getRuntimeDepfile (/home/tom/Code/Code9/JavaScript/Projects/test-next.js/services/api-serverless/node_modules/serverless-kubeless/lib/helpers.js:182:34)
    at ReadStream.s.on (/home/tom/Code/Code9/JavaScript/Projects/test-next.js/services/api-serverless/node_modules/serverless-kubeless/deploy/kubelessDeploy.js:103:39)
    at ReadStream.emit (events.js:193:15)
    at ReadStream.EventEmitter.emit (domain.js:441:20)
    at endReadableNT (_stream_readable.js:1129:12)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)

Looking at some other tickets, it might have been an env var $KUBECONFIG, but I have no env var defined like this.

I don't know what to do, but the hello world doesn't work on minikube.

Minikube is mentioned here: https://serverless.com/framework/docs/providers/kubeless/guide/installation

andresmgot commented 5 years ago

hi @Industrial,

it seems that it's failing to retrieve the Kubeless configuration. That shouldn't be a problem with Minikube. Did you install kubeless in the default namespace? Are you able to retrieve the kubeless configuration with kubectl get configmap -n kubeless?

Industrial commented 5 years ago
$ minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
$ kubectl get configmap -n kubeless
No resources found.

(command I found to get some status printed ..)

$ kubectl top node
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)
Industrial commented 5 years ago

@andresmgot

I can get to the Kubernetes dashboard with minikube dashboard

Industrial commented 5 years ago

Ah, my bad. I didn't acttivate/install Kubeless on Minikube correctly.

To prevent this situation, I've created a little shell script. I understand this isn't the most time-efficient method but at least it's fault tolerant ;-)

#!/usr/bin/env bash

# Refresh Minikube
minikube stop
minikube delete
minikube start

# Refresh Kubeless
export RELEASE=$(curl -s https://api.github.com/repos/kubeless/kubeless/releases/latest | grep tag_name | cut -d '"' -f 4)
kubectl create ns kubeless
kubectl create -f https://github.com/kubeless/kubeless/releases/download/$RELEASE/kubeless-$RELEASE.yaml

# Refresh Serverless
serverless deploy -v
andresmgot commented 5 years ago

I am glad you got it finally working. Thanks for the script suggestion!

Industrial commented 5 years ago

Ah, that's just for myself until I get accustomed to the layers involved :-)

I'll now try yo migrate some services (Prisma GraphQL, GraphQL-Yoga, some REST stuff) from Docker into serverless/Kubernetes.