k8s-cookbook / recipes

Kubernetes Cookbook
http://k8s.cookbook.fyi
Apache License 2.0
169 stars 89 forks source link

14.7 Deploying Functions with Kubeless #16

Open bennybhlin opened 6 years ago

bennybhlin commented 6 years ago

I hope this is the last question ;-D

For this case, I found kubeless-rbac-0.3.1.yaml had an unnecessary line:

description: Kubernetes Native Serverless Framework

This line should be omitted then I could run 'kubectl create -f'

However, I noticed one thing after all objects wew created: 2 pods (kafka-0 & zoo-0 both had error in dashboard: pod has unbound immediate PersistentVolumeClaims)(I swear last night this recipe went well until the last step to call function, but somehow it fails from beginning today), then I found this

$ kubectl get pvc -n kubeless NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE datadir-kafka-0 Pending 7m31s zookeeper-zoo-0 Pending 7m30s

So I verified one pvc of kafka:

$ kubectl describe pvc/datadir-kafka-0 -n kubeless Name: datadir-kafka-0 Namespace: kubeless StorageClass: Status: Pending Volume: Labels: kubeless=kafka Annotations: Finalizers: [kubernetes.io/pvc-protection] Capacity: Access Modes: Events: Type Reason Age From Message


Normal FailedBinding 2m44s (x26 over 8m30s) persistentvolume-controller no persistent volumes available for this claim and no storage class is set Mounted By: kafka-0

This is weird; I remember a PVC could create a volume automatically as recipe 8.5 explained, so I tried to verify default storageClass in my k8s cluster:

$ kubectl get storageclass No resources found. $ kubectl get storageclass --all-namespaces No resources found.

I think this is why my pvc is pending and bound with any auto-provisioned volume. But why? I was supposed to have this default storageClass. For example, my Minikube has a default storageClass named 'standard'.

Now I wonder how can I recreate my own default storageClass in my k8s cluster? I even do not know which Provisioner should I use - because my cluster is running inside a VMWare Workstation Player VM.

mhausenblas commented 6 years ago

I hope it's not the last! :)

Hailing Mr @sebgoa since this is his baby …

sebgoa commented 6 years ago

so kubeless has more recent versions, you should use that.

we will edit the recipe.

bennybhlin commented 6 years ago

Tried kubeless 1.0.0-alpha.8, got this error

$ kubeless function call post-python --data '{"oreilly":"function"}' ERRO[0000] FATA[0000] an error on the server ("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">

Error: 500 Internal Server Error

Error: 500 Internal Server Error

Sorry, the requested URL 'http://192.168.0.200:6443/' caused an error:

Internal Server Error
") has prevented the request from succeeding BTW, I created function like this because option --trigger-http is not supported kubeless function deploy post-python --runtime python2.7 --handler post.handler --from-file post.py Since serverless is a whole new thing to me, I have no idea whre should I start to look at first. Should I keep this recipe 'as is'?