feat(k8s): adding kubernetes support #12
|
@ -0,0 +1,53 @@
|
||||||
|
# Kubernetes
|
||||||
|
|
||||||
|
## Getting started with Kind
|
||||||
|
|
||||||
|
1. Create your [Kind](https://kind.sigs.k8s.io/) cluster
|
||||||
|
|
||||||
|
```shell
|
||||||
|
kind create cluster --config misc/k8s/kind/bouncer-cluster.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Deploy required operators
|
||||||
|
|
||||||
|
```shell
|
||||||
|
kubectl apply -k misc/k8s/kind/cluster --server-side
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Deploy your Bouncer development environment
|
||||||
|
|
||||||
|
```shell
|
||||||
|
skaffold dev -p dev --cleanup=false --default-repo reg.cadoles.com/<YOUR_PERSONNAL_USER_NAME>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
1. Open shell in bouncer-admin pod
|
||||||
|
|
||||||
|
```shell
|
||||||
|
kubectl exec -it -n bouncer-dev bouncer-admin-<suffix> -- /bin/sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Create an authentication token
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bouncer auth create-token > .bouncer-token
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Create a proxy and enable it
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bouncer admin proxy create --proxy-to https://www.cadoles.com --proxy-name cadoles
|
||||||
|
bouncer admin proxy update --proxy-name cadoles --proxy-enabled=true
|
||||||
|
```
|
||||||
|
|
||||||
|
4. With you host web browser, open http://localhost:9000, you should see the Cadoles website.
|
||||||
|
|
||||||
|
## Benchmarking
|
||||||
|
|
||||||
|
You can use [`siege`](https://github.com/JoeDog/siege) to benchmark your instance with the Cadoles proxy.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
BASE_URL=http://localhost:9000 make siege
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
kind: Cluster
|
||||||
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
|
name: bouncer-dev
|
|
@ -0,0 +1,5 @@
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- https://forge.cadoles.com/CadolesKube/c-kustom//base/redis?ref=develop
|
|
@ -28,9 +28,9 @@ admin:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
addresses:
|
addresses:
|
||||||
- ${REDIS_SENTINEL_HOST}:${REDIS_SENTINEL_PORT}
|
- rfs-bouncer-redis:${RFS_BOUNCER_REDIS_SERVICE_PORT}
|
||||||
master: "${REDIS_MASTER_NAME}"
|
master: mymaster
|
||||||
|
|
||||||
logger:
|
logger:
|
||||||
level: 3
|
level: 2
|
||||||
format: human
|
format: human
|
||||||
|
|
|
@ -9,9 +9,4 @@ configMapGenerator:
|
||||||
- name: bouncer-admin-config
|
- name: bouncer-admin-config
|
||||||
files:
|
files:
|
||||||
- ./files/config.yml
|
- ./files/config.yml
|
||||||
- ./files/admin-key.json
|
- ./files/admin-key.json
|
||||||
- name: bouncer-admin-env
|
|
||||||
literals:
|
|
||||||
- REDIS_SENTINEL_HOST="rfs-$(REDIS_SERVICE_NAME)"
|
|
||||||
- REDIS_SENTINEL_PORT="26379"
|
|
||||||
- REDIS_MASTER_NAME="mymaster"
|
|
|
@ -19,15 +19,9 @@ spec:
|
||||||
containers:
|
containers:
|
||||||
- name: bouncer-admin
|
- name: bouncer-admin
|
||||||
image: reg.cadoles.com/cadoles/bouncer:v2024.2.5-1602626
|
image: reg.cadoles.com/cadoles/bouncer:v2024.2.5-1602626
|
||||||
command: ["bouncer"]
|
command: ["bouncer", "--debug", "-c", "/etc/bouncer/config.yml", "server", "admin", "run"]
|
||||||
args: ["--debug", "-c", "/etc/bouncer/config.yml", "server", "admin", "run"]
|
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
envFrom:
|
resources: {}
|
||||||
- configMapRef:
|
|
||||||
name: bouncer-admin-env
|
|
||||||
env:
|
|
||||||
- name: REDIS_SENTINEL_HOST
|
|
||||||
value: "rfs-$(REDIS_SERVICE_NAME)"
|
|
||||||
ports:
|
ports:
|
||||||
- name: bouncer-admin
|
- name: bouncer-admin
|
||||||
containerPort: 8081
|
containerPort: 8081
|
||||||
|
@ -37,4 +31,4 @@ spec:
|
||||||
volumes:
|
volumes:
|
||||||
- name: bouncer-admin-config
|
- name: bouncer-admin-config
|
||||||
configMap:
|
configMap:
|
||||||
name: bouncer-admin-config
|
name: bouncer-admin-config
|
|
@ -9,6 +9,6 @@ spec:
|
||||||
ports:
|
ports:
|
||||||
- name: bouncer-admin
|
- name: bouncer-admin
|
||||||
port: 8081
|
port: 8081
|
||||||
targetPort: 8080
|
targetPort: bouncer-admin
|
||||||
selector:
|
selector:
|
||||||
io.kompose.service: bouncer-admin
|
io.kompose.service: bouncer-admin
|
||||||
|
|
|
@ -14,9 +14,9 @@ layers:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
addresses:
|
addresses:
|
||||||
- ${RFS_BOUNCER_REDIS_SERVICE_HOST}:${RFS_BOUNCER_REDIS_SERVICE_PORT}
|
- rfs-bouncer-redis:${RFS_BOUNCER_REDIS_SERVICE_PORT}
|
||||||
master: "${REDIS_MASTER_NAME}"
|
master: mymaster
|
||||||
|
|
||||||
logger:
|
logger:
|
||||||
level: 3
|
level: 2
|
||||||
format: human
|
format: human
|
||||||
|
|
|
@ -21,6 +21,7 @@ spec:
|
||||||
image: reg.cadoles.com/cadoles/bouncer:v2024.2.5-1602626
|
image: reg.cadoles.com/cadoles/bouncer:v2024.2.5-1602626
|
||||||
command: ["bouncer", "-c", "/etc/bouncer/config.yml", "server", "proxy", "run"]
|
command: ["bouncer", "-c", "/etc/bouncer/config.yml", "server", "proxy", "run"]
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
|
resources: {}
|
||||||
ports:
|
ports:
|
||||||
- name: bouncer-server
|
- name: bouncer-server
|
||||||
containerPort: 8080
|
containerPort: 8080
|
||||||
|
|
|
@ -9,6 +9,6 @@ spec:
|
||||||
ports:
|
ports:
|
||||||
- name: bouncer-server
|
- name: bouncer-server
|
||||||
port: 8080
|
port: 8080
|
||||||
targetPort: 8080
|
targetPort: bouncer-server
|
||||||
selector:
|
selector:
|
||||||
io.kompose.service: bouncer-server
|
io.kompose.service: bouncer-server
|
||||||
|
|
|
@ -33,8 +33,7 @@ build:
|
||||||
- cmd/**
|
- cmd/**
|
||||||
- internal/**
|
- internal/**
|
||||||
- layers/**
|
- layers/**
|
||||||
- tools/**
|
- misc/**
|
||||||
- data/**
|
|
||||||
docker:
|
docker:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ deploy:
|
||||||
statusCheckDeadlineSeconds: 600
|
statusCheckDeadlineSeconds: 600
|
||||||
|
|
||||||
portForward:
|
portForward:
|
||||||
- resourceType: deployment
|
- resourceType: service
|
||||||
resourceName: bouncer-admin
|
resourceName: bouncer-admin
|
||||||
namespace: bouncer-dev
|
namespace: bouncer-dev
|
||||||
port: 8081
|
port: 8081
|
||||||
|
|
Loading…
Reference in New Issue