update k8s document and yml (#284)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
8e98e0b6fe
commit
411b6efc4a
36
README.md
36
README.md
|
@ -751,40 +751,32 @@ $ http -v --verify=no --json GET http://your.docker.host/api/stat/go
|
||||||
|
|
||||||
## Run gorush in Kubernetes
|
## Run gorush in Kubernetes
|
||||||
|
|
||||||
Please make sure you are install [Minikube](https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/) first.
|
|
||||||
|
|
||||||
### Create a Minikube cluster
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ minikube start --vm-driver=xhyve
|
|
||||||
```
|
|
||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
Start the gorush with one command:
|
Create name space `gorush`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ kubectl create -f k8s
|
$ kubectl create -f k8s/gorush-namespace.yaml
|
||||||
deployment "frontend" created
|
|
||||||
service "frontend" created
|
|
||||||
deployment "redis-master" created
|
|
||||||
service "redis-master" created
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, list all your Services:
|
Create redis service:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ kubectl get services
|
$ kubectl create -f k8s/gorush-redis-deployment.yaml
|
||||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
$ kubectl create -f k8s/gorush-redis-service.yaml
|
||||||
frontend 10.0.0.156 <pending> 8088:32517/TCP 30s
|
|
||||||
kubernetes 10.0.0.1 <none> 443/TCP 14d
|
|
||||||
redis-master 10.0.0.67 <none> 6379/TCP 30s
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### view the gorush home page
|
Create gorush service:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ minikube service frontend
|
$ kubectl create -f k8s/gorush-deployment.yaml
|
||||||
|
$ kubectl create -f k8s/gorush-service.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ingress Controller for AWS ALB
|
||||||
|
|
||||||
|
```
|
||||||
|
$ kubectl create -f k8s/gorush-aws-ingress.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean up the gorush:
|
### Clean up the gorush:
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: gorush
|
||||||
|
namespace: gorush
|
||||||
|
annotations:
|
||||||
|
# Kubernetes Ingress Controller for AWS ALB
|
||||||
|
# https://github.com/coreos/alb-ingress-controller
|
||||||
|
alb.ingress.kubernetes.io/scheme: internet-facing
|
||||||
|
alb.ingress.kubernetes.io/subnets: "subnet-3cd22c75,subnet-4aff342d"
|
||||||
|
alb.ingress.kubernetes.io/security-groups: sg-329c2b54
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: gorush.example.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
backend:
|
||||||
|
serviceName: gorush
|
||||||
|
servicePort: 8088
|
|
@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: gorush
|
name: gorush
|
||||||
|
namespace: gorush
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
template:
|
template:
|
||||||
|
@ -11,17 +12,10 @@ spec:
|
||||||
tier: frontend
|
tier: frontend
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: gorush
|
- image: appleboy/gorush
|
||||||
image: appleboy/gorush
|
name: gorush
|
||||||
|
imagePullPolicy: Always
|
||||||
command: ["/gorush"]
|
command: ["/gorush"]
|
||||||
args: ["-c", "config.yml", "-e", "redis", "--redis-addr", "redis:6379"]
|
args: ["-c", "config.yml", "-e", "redis", "--redis-addr", "redis:6379"]
|
||||||
env:
|
|
||||||
- name: GET_HOSTS_FROM
|
|
||||||
# value: dns
|
|
||||||
# If your cluster config does not include a dns service, then to
|
|
||||||
# instead access environment variables to find service host
|
|
||||||
# info, comment out the 'value: dns' line above, and uncomment the
|
|
||||||
# line below:
|
|
||||||
value: env
|
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8088
|
- containerPort: 8088
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: gorush
|
|
@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: redis
|
name: redis
|
||||||
|
namespace: gorush
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
template:
|
template:
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: redis
|
name: redis
|
||||||
|
namespace: gorush
|
||||||
labels:
|
labels:
|
||||||
app: redis
|
app: redis
|
||||||
role: master
|
role: master
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: gorush
|
name: gorush
|
||||||
|
namespace: gorush
|
||||||
labels:
|
labels:
|
||||||
app: gorush
|
app: gorush
|
||||||
tier: frontend
|
tier: frontend
|
||||||
|
@ -9,6 +10,7 @@ spec:
|
||||||
# if your cluster supports it, uncomment the following to automatically create
|
# if your cluster supports it, uncomment the following to automatically create
|
||||||
# an external load-balanced IP for the frontend service.
|
# an external load-balanced IP for the frontend service.
|
||||||
# type: LoadBalancer
|
# type: LoadBalancer
|
||||||
|
type: NodePort
|
||||||
ports:
|
ports:
|
||||||
- port: 8088
|
- port: 8088
|
||||||
selector:
|
selector:
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: gorush
|
|
||||||
annotations:
|
|
||||||
http.port: "8089"
|
|
||||||
spec:
|
|
||||||
backend:
|
|
||||||
serviceName: gorush
|
|
||||||
servicePort: 8088
|
|
Loading…
Reference in New Issue