mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
add link to Fn Helm Chart (#573)
Removes old k8s doc and script in favor of linking to the new Helm Chart.
This commit is contained in:
@@ -48,7 +48,7 @@ If you are operating Fn, this section is for you.
|
|||||||
### Advanced
|
### Advanced
|
||||||
|
|
||||||
* [Extending Fn](operating/extending.md)
|
* [Extending Fn](operating/extending.md)
|
||||||
* [Running Fn on Kubernetes](operating/kubernetes/README.md)
|
* [Kubernetes Helm Chart for Fn](https://github.com/fnproject/fn-helm/)
|
||||||
* [Setting up development environment with Docker compose](./operating/compose.md)
|
* [Setting up development environment with Docker compose](./operating/compose.md)
|
||||||
* [OpenStack Triggers](operating/triggers.md)
|
* [OpenStack Triggers](operating/triggers.md)
|
||||||
* [Docker Configuration](operating/docker.md)
|
* [Docker Configuration](operating/docker.md)
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
# How to run Fn on Kubernetes
|
|
||||||
|
|
||||||
*Prerequisite 1: working Kubernetes cluster (v1.7+), and a locally configured kubectl.*
|
|
||||||
|
|
||||||
## Quickstart
|
|
||||||
|
|
||||||
### Steps
|
|
||||||
|
|
||||||
1. Deploy Fn to the Kubernetes cluster:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ cd docs/operating/kubernetes/
|
|
||||||
$ kubectl create -f fn-service.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Once the Pods have started, check the service for the load balancer IP:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ kubectl -n fn 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.
|
|
||||||
|
|
||||||
3. Test the cluster:
|
|
||||||
|
|
||||||
If you are using a Kubernetes setup that can expose a public load balancer, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ export FN_API_URL=http://$(kubectl -n fn get service/fn-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}:{.spec.ports[?(@.name=="fn-service")].port}')
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using a Kubernetes setup like minikube, run
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ export FN_API_URL=$(minikube -n fn service fn-service --url)
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, test by creating a function via curl:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' $FN_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" } }' $FN_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" }' $FN_API_URL/r/myapp/hello-sync
|
|
||||||
Hello Johnny!
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also use the [Fn CLI](https://github.com/fnproject/cli):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ export FN_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
|
|
||||||
|
|
||||||
$ echo '{"name":"Johnny"}' | fn call myapp /hello-sync
|
|
||||||
Hello Johnny!
|
|
||||||
```
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: fn
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: fn-service-config
|
|
||||||
namespace: fn
|
|
||||||
data:
|
|
||||||
FN_MQ_URL: redis://fn-redis-master.fn
|
|
||||||
FN_DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master.fn:3306)/fn
|
|
||||||
FN_API_URL: http://fn-service.fn:8080
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: fn-service
|
|
||||||
namespace: fn
|
|
||||||
labels:
|
|
||||||
app: fn
|
|
||||||
role: fn-service
|
|
||||||
spec:
|
|
||||||
type: LoadBalancer
|
|
||||||
ports:
|
|
||||||
- name: fn-service
|
|
||||||
port: 8080
|
|
||||||
targetPort: 8080
|
|
||||||
selector:
|
|
||||||
app: fn
|
|
||||||
role: fn-service
|
|
||||||
---
|
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: DaemonSet
|
|
||||||
metadata:
|
|
||||||
name: fn-service
|
|
||||||
namespace: fn
|
|
||||||
spec:
|
|
||||||
updateStrategy:
|
|
||||||
type: RollingUpdate
|
|
||||||
rollingUpdate:
|
|
||||||
maxUnavailable: 1
|
|
||||||
minReadySeconds: 30
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: fn
|
|
||||||
role: fn-service
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: fn-service
|
|
||||||
image: fnproject/fnserver:latest
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
env:
|
|
||||||
- name: FN_MQ_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: fn-service-config
|
|
||||||
key: FN_MQ_URL
|
|
||||||
- name: FN_DB_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: fn-service-config
|
|
||||||
key: FN_DB_URL
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: fn-ui
|
|
||||||
namespace: fn
|
|
||||||
labels:
|
|
||||||
app: fn
|
|
||||||
role: fn-ui
|
|
||||||
spec:
|
|
||||||
type: LoadBalancer
|
|
||||||
ports:
|
|
||||||
- port: 80
|
|
||||||
targetPort: 80
|
|
||||||
selector:
|
|
||||||
app: fn
|
|
||||||
role: fn-ui
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: fn-ui
|
|
||||||
namespace: fn
|
|
||||||
labels:
|
|
||||||
app: fn
|
|
||||||
role: fn-ui
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: fn
|
|
||||||
role: fn-ui
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: fn-ui
|
|
||||||
image: fnproject/ui:latest
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
env:
|
|
||||||
- name: PORT
|
|
||||||
value: "80"
|
|
||||||
- name: FN_API_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: fn-service-config
|
|
||||||
key: FN_API_URL
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: fn-mysql-master
|
|
||||||
namespace: fn
|
|
||||||
labels:
|
|
||||||
app: mysql
|
|
||||||
role: datastore
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 3306
|
|
||||||
targetPort: 3306
|
|
||||||
selector:
|
|
||||||
app: mysql
|
|
||||||
role: datastore
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: fn-mysql-master
|
|
||||||
namespace: fn
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: mysql
|
|
||||||
role: datastore
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: fn-mysql
|
|
||||||
image: mysql:5.7
|
|
||||||
args:
|
|
||||||
- "--max-connections=500"
|
|
||||||
- "--wait-timeout=300"
|
|
||||||
ports:
|
|
||||||
- containerPort: 3306
|
|
||||||
env:
|
|
||||||
- name: MYSQL_ROOT_PASSWORD
|
|
||||||
value: fnsecretpassword
|
|
||||||
- name: MYSQL_DATABASE
|
|
||||||
value: fn
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: fn-redis-master
|
|
||||||
namespace: fn
|
|
||||||
labels:
|
|
||||||
app: redis
|
|
||||||
role: mq
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 6379
|
|
||||||
targetPort: 6379
|
|
||||||
selector:
|
|
||||||
app: redis
|
|
||||||
role: mq
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: fn-redis-master
|
|
||||||
namespace: fn
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: redis
|
|
||||||
role: mq
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: fn-redis
|
|
||||||
image: redis:4.0
|
|
||||||
ports:
|
|
||||||
- containerPort: 6379
|
|
||||||
Reference in New Issue
Block a user