具体部署还是比较简单的,以下为官方参考,只是有一个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. windows vs 编译tesseract-ocr

    第一把所有相关的代码都下载,github最方便 https://github.com/tesseract-ocr/tesseract 要点1.cppan c++的中文管理包,很方便,需要翻-墙,安装包 ...

  2. idea中如何debug本地maven项目

    方法一:使用maven中的jetty插件调试本地maven项目 1.打断点 2.右击“jetty:run”,选择Debug运行 3.浏览器发送http请求,开始调试 方法二:利用远程调试功能调试本地m ...

  3. Eclipse 启动tomcat 访问主页报错404

    问题 tomcat用startup.sh启动,访问localhost:8080能正常访问,用Eclipse service启动tomcat,访问localhost:8080报错404 解决方法 1. ...

  4. 使用Idea 配置maven

    使用Idea 配置maven 使用idea 配置maven有4步: (1)下载Idea,maven (2)安装idea, (3)设置maven的环境变量, (4)具体的配置过程 当前环境: 操作系统: ...

  5. 使用IDEA将代码托管到GitHub步骤和错误解决

    一.下载并安装Git版本控制工具 下载地址:https://git-scm.com/downloads 注册GitHub账号:https://github.com/ 为什么托管到GitHub要下载Gi ...

  6. LeetCode第[14]题(Java): Longest Common Prefix

    题目:最长公共前缀 难度:EASY 题目内容: Write a function to find the longest common prefix string amongst an array o ...

  7. python学习笔记(接口自动化框架 V1.0)

    之前是利用python自带的unittest测试框架 这次自己设计一个 之后再一点点往里面加功能 (ps:当然这个框架真的是很简单..很简单...很简单...) excel文件格式: #!/usr/b ...

  8. macOS 10.12 任何来源

    sudo spctl --master-disable 从旧系统升级过来的仍然会显示“任何来源”选项,全新安装的将不再显示这个选项.可以通过上面的命令重新显示出此选项,非必要建议不要修改.

  9. main函数的一点知识

    main函数参数意义. main函数执行前. main还是执行后.

  10. 【枚举】【最小生成树】【kruscal】bzoj3754 Tree之最小方差树

    发现,若使方差最小,则使Σ(wi-平均数)2最小即可. 因为权值的范围很小,所以我们可以枚举这个平均数,每次把边权赋成(wi-平均数)2,做kruscal. 但是,我们怎么知道枚举出来的平均数是不是恰 ...