Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
feat: gateway k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
sysatom committed May 28, 2021
1 parent aa243ff commit ac14166
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 160 deletions.
20 changes: 9 additions & 11 deletions deployments/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,27 @@ Create a namespace in the cluster to manage all the resources of Xconf. Edit `na

### Edit config files

- [ALL Files] Replace `$MICRO_REGISTRY_ADDRESS` to your cluser etcd address or your own etcd service address.
- [ALL Files] Check the version of image, change if you want.
- [config-srv.yaml] Replace `$DATABASE_URL` to your own MySQL database url.
- Change other fields if you know what you are doing.
### Create ConfigMap

```
kubectl create -f configmaps.yaml
```

### Create Kubernets resources

```
kubectl create -f micro.yaml
kubectl create -f config-srv.yaml
kubectl create -f agent-api.yaml
kubectl create -f admin-api.yaml
kubectl create -f gateway.yaml
```

### Access Admin UI

By default the micro-api will be exposed by LoadBalancer, check service `micro` under namespace `xconf` for detail.
By default the micro-api will be exposed by LoadBalancer, check service `gateway` under namespace `assistant` for detail.

`kubectl describe --namespace xconf service micro`
`kubectl describe --namespace assistant service gateway`

You will find the Ingress address and the port.

Use url `http://addr:port/admin/ui/` to access the admin UI.
Use url `http://addr:port/` to access the web.

## 2. Update

Expand Down
7 changes: 7 additions & 0 deletions deployments/kubernetes/configmaps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: xconf-config
namespace: assistant
data:
xconf.url: http://127.0.0.1:8080
49 changes: 49 additions & 0 deletions deployments/kubernetes/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: gateway
namespace: assistant
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 0
selector:
matchLabels:
app: gateway
template:
metadata:
labels:
app: gateway
spec:
containers:
- name: gateway
image: 'tsundata/gateway:0.0.1'
imagePullPolicy: Always
env:
- name: XCONF_URL
valueFrom:
configMapKeyRef:
name: xconf-config
key: xconf.url
- name: XCONF_CLUSTER
value: dev
- name: XCONF_NAMESPACE
value: gateway
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
namespace: assistant
name: gateway
spec:
ports:
- port: 5000
targetPort: 5000
selector:
app: gateway
type: LoadBalancer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: xconf
name: assistant
labels:
name: xconf
name: assistant
33 changes: 0 additions & 33 deletions deployments/kubernetes/xconf/admin-api.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions deployments/kubernetes/xconf/agent-api.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions deployments/kubernetes/xconf/config-srv.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions deployments/kubernetes/xconf/micro.yaml

This file was deleted.

0 comments on commit ac14166

Please sign in to comment.