K8s docs update (#499)

* split fn-ui to its own service

* add fn namespace

* update path

* add namespace flag for kubectl

* simplify grabbing minikube IP and port

* typo: FUNCTIONS -> API_URL
This commit is contained in:
Derek Schultz
2017-11-16 10:45:25 -07:00
committed by GitHub
parent 724d3730a3
commit c281f96486
2 changed files with 56 additions and 14 deletions

View File

@@ -9,14 +9,14 @@
1. Deploy Fn to the Kubernetes cluster:
```bash
$ cd docs/operating/
$ 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 get svc --watch
$ 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
@@ -31,14 +31,13 @@ Note that `fn-service` is initially pending on allocating an external IP. The `k
If you are using a Kubernetes setup that can expose a public load balancer, run:
```bash
$ export FUNCTIONS=$(kubectl get -o json svc fn-service | jq -r '.status.loadBalancer.ingress[0].ip'):8080
$ export API_URL=$(kubectl -n fn get -o json svc fn-service | jq -r '.status.loadBalancer.ingress[0].ip'):8080
```
If you are using a Kubernetes setup like minikube, run
```bash
$ 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
$ export API_URL=$(minikube -n fn service fn-service --url)
```
Now, test by creating a function via curl:

View File

@@ -1,17 +1,23 @@
apiVersion: v1
kind: Namespace
metadata:
name: fn
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fn-service-config
namespace: default
namespace: fn
data:
MQ_URL: redis://fn-redis-master.default
DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master:3306)/fn
API_URL: http://fn-service:8080
MQ_URL: redis://fn-redis-master.fn
DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master.fn:3306)/fn
API_URL: http://fn-service.fn:8080
---
apiVersion: v1
kind: Service
metadata:
name: fn-service
namespace: fn
labels:
app: fn
role: fn-service
@@ -21,9 +27,6 @@ spec:
- name: fn-service
port: 8080
targetPort: 8080
- name: fn-ui
port: 80
targetPort: 80
selector:
app: fn
role: fn-service
@@ -32,6 +35,7 @@ apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: fn-service
namespace: fn
spec:
updateStrategy:
type: RollingUpdate
@@ -62,6 +66,41 @@ spec:
configMapKeyRef:
name: fn-service-config
key: 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:
@@ -79,6 +118,7 @@ apiVersion: v1
kind: Service
metadata:
name: fn-mysql-master
namespace: fn
labels:
app: mysql
role: datastore
@@ -94,6 +134,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: fn-mysql-master
namespace: fn
spec:
replicas: 1
template:
@@ -120,6 +161,7 @@ apiVersion: v1
kind: Service
metadata:
name: fn-redis-master
namespace: fn
labels:
app: redis
role: mq
@@ -135,6 +177,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: fn-redis-master
namespace: fn
spec:
replicas: 1
template:
@@ -147,4 +190,4 @@ spec:
- name: fn-redis
image: redis:4.0
ports:
- containerPort: 6379
- containerPort: 6379