具体部署还是比较简单的,以下为官方参考,只是有一个service type 为 loadBlancer 实际使用需要修改为NodePort 

Prerequisite 1: working Kubernetes cluster (v1.7+), and a locally configured kubectl.

Quickstart

Steps

  1. Deploy Fn to the Kubernetes cluster:
$ cd docs/operating/
$ kubectl create -f fn-service.yaml
  1. Once the Pods have started, check the service for the load balanacer IP:
$ kubectl get svc --watch
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
fn-mysql-master 10.96.57.185 <none> 3306/TCP 10m
fn-redis-master 10.96.127.51 <none> 6379/TCP 10m
fn-service 10.96.245.95 <pending> 8080:30768/TCP,80:31921/TCP 10m
kubernetes 10.96.0.1 <none> 443/TCP 15d

Note that fn-service is initially pending on allocating an external IP. The kubectl get svc --watch command will update this once an IP has been assigned.

  1. Test the cluster:

If you are using a Kubernetes setup that can expose a public load balancer, run:

$ export FUNCTIONS=$(kubectl get -o json svc fn-service | jq -r '.status.loadBalancer.ingress[0].ip'):8080

If you are using a Kubernetes setup like minikube, run

$ echo $(minikube ip):$(kubectl get svc fn-service -o json | jq -r '.spec.ports[0].nodePort')
192.168.99.100:30966
$ export API_URL=http://192.168.99.100:30966

Now, test by creating a function via curl:

$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$API_URL/v1/apps
{"message":"App successfully created","app":{"name":"myapp","config":null}} $ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"fnproject/hello" } }' http://$API_URL/v1/apps/myapp/routes
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"fnproject/hello","memory":128,"headers":{},"type":"sync","format":"default","timeout":30,"idle_timeout":30,"config":{}}} $ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$API_URL/r/myapp/hello-sync
Hello Johnny!

You can also use the Fn CLI:

$ export API_URL=http://192.168.99.100:30966
$ fn apps list
myapp
$ fn routes list myapp
path image endpoint
/hello-sync fnproject/hello 192.168.99.100:30966/r/myapp/hello-sync
 

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

 
 
 
 

fn project k8s 集成的更多相关文章

  1. Team Foundation Server (TFS)与Project Server集成,使用DNS(友好地址)地址注册PWA

    问题描述: 当Team Foundation Server(TFS 2010/2012/2013)与Project Server高可用性的环境集成时,必然会使用Project Server (PWA) ...

  2. fn project 试用之后的几个问题的解答

    今天试用fnproject  之后自己有些思考,后面继续解决   1. 目前测试是强依赖 dockerhub 的,实际可能不是很方便 2. 如何与k8s .mesos.docker swarm  集成 ...

  3. fn project 私有镜像发布

    1. 说明 fnproject 默认的docker registry 是 dockerhub 对于企业应用还是不太方便的 还好系统系统了配置参数方便我们进行配置,与开源harbor 进行集成 2. 使 ...

  4. fn project 试用之后的几个问题

    今天试用fnproject  之后自己有些思考,后面继续解决   1. 目前测试是强依赖 dockerhub 的,实际可能不是很方便 2. 如何与k8s .mesos.docker swarm  集成 ...

  5. openfaas k8s 集成

    备注 k8s 1.6 以下版本与k8s 1.6 以上版本会有一些简单的区别 1. 克隆k8s  部署文档   https://github.com/openfaas/faas-netes   2. 创 ...

  6. fn project 扩展

    目前支持的扩展方式   Listeners - listen to API events such as a route getting updated and react accordingly. ...

  7. fn project 生产环境使用

    此为官方的参考说明   Running Fn in Production The QuickStart guide is intended to quickly get started and kic ...

  8. fn project 对象模型

    Applications At the root of everything are applications. In fn, an application is essentially a grou ...

  9. fn project AWS Lambda 格式 functions

      Creating Lambda Functions Creating Lambda functions is not much different than using regular funct ...

随机推荐

  1. undefined symbol: PyUnicodeUCS4_AsUTF8String

    python 默认是ucs2编码进行编译,重新编译使用ucs4. python:     ./configure --enable-unicode=ucs4        make && ...

  2. 安装pycurl

    环境:ubuntu 1604 安装 pycurl 遇到一些问题 简单记录 1.安装 pippython2:apt install python-pippython3: apt install pyth ...

  3. Linux系统下Git操作命令整理

    1.显示当前的配置信息 git config --list 2. 创建repo从别的地方获取 git clone git://git.kernel.org/pub/scm/git/git.git 自己 ...

  4. Percona 工具包 pt-online-schema-change 简介

    mysql的在线表结构修改,因为低效和阻塞读写.一直被诟病.至于ALTER TABLE 的原理,参看我上一篇文章.MySQL在线修改大表结构.看完后,发现的问题是还是会锁的,且对于在线更新的这块也是不 ...

  5. Caffe2——C++ 预测(predict)Demo

    因为最近入坑Caffe2,它最近还一直在更新,所以坑比较多,官方也只给出了python的demo,C++的暂时还找不到,有也只有一个简单版的,不够用,所以就总结了一下,结合网上和自己的实践,整理了一下 ...

  6. LeetCode——Find All Numbers Disappeared in an Array

    LeetCode--Find All Numbers Disappeared in an Array Question Given an array of integers where 1 ≤ a[i ...

  7. Java值传递还是引用传递?

    回顾: 在程序设计语言中,将参数传递分为按值调用和按引用调用.按值调用:表示方法接收的是调用者提供的值.而按引用调用表示方法接收的是调用者提供的变量地址.一个方法可以修改传递引用所对应的变量值,而不能 ...

  8. 关于log4j.properties例子:DailyRollingFileAppender

    package com.v512.log4j; import org.apache.log4j.Logger; public class HelloLog4J { // 构造记录器,形参是记录器所在的 ...

  9. 新版appium绘制九宫格的一个注意点

    在用appium-desktop-setup-1.6.2进行app手势密码设置时,发现move_to(x, y)相对偏移量的方法用不了,绘制的手势也是乱跑 还会抛一个错误 selenium.commo ...

  10. 【Hive】自定义函数

    Hive的自定义函数无法满足实际业务的需要,所以为了扩展性,Hive官方提供了自定义函数来实现需要的业务场景. 1.定义 (1)udf(user defined function):  自定义函数,特 ...