Title: Serverless for Java development

Categories: java serverless docker yaml

Description: 我的第一个ServerLess 程序

Keywords: Serverless kubeless

Server Less 我的第一个简单的实例。

前言

Serverless 适用场景:

quick start [fnproject]

kubeless [整理中]

```yaml


apiVersion: k8s.io/v1 kind: Function metadata: name: function1 spec: handler: hello.foobar image: registry.timeondata.com/firsh_demo/kubeless_runtime_python:2.7.1 runtime: python2.7 deps: | cowpy function: | import time import random from cowpy import cow def foobar(): # NB: delay will be negative and sleep will raise an error # occasionally. This is a feature for demoing errors. delay = random.normalvariate(0.3, 0.2) time.sleep(delay) msg = "hello world - with a %0.2fs artificial delay" % delay c = cow.get_cow() return c().milk(msg) ```

```bash ➜ python git:(master) ✗ kubectl create -f function1.yaml

```

 # 检查启动
 ➜  python git:(master) ✗ kubeless function ls
NAME        NAMESPACE   HANDLER         RUNTIME     TYPE    TOPIC   DEPENDENCIES    STATUS
function1   default     hello.foobar    python2.7                   cowpy           1/1 READY
    kubeless function call  function1 
➜  python git:(master) ✗ kubeless function call  function1
 _____________________________________________
< hello world - with a 0.42s artificial delay >
 ---------------------------------------------
     \   ^__^
      \  (oo)\_______
         (__)\       )\/\
           ||----w |
           ||     ||

转载请注明出处,本文采用 CC4.0 协议授权