2024-02-15 15:15:41 +01:00
|
|
|
# Kubernetes
|
|
|
|
|
2024-02-19 11:01:01 +01:00
|
|
|
## Initialize your project
|
|
|
|
|
|
|
|
1. Generate the Docker configuration to enable image builds with Kaniko and communicate with reg.cadoles.com
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
docker login reg.cadoles.com
|
|
|
|
mkdir -p misc/k8s/kustomization/base/secrets/dockerconfig
|
|
|
|
docker --config misc/k8s/kustomization/base/secrets/dockerconfig login reg.cadoles.com
|
|
|
|
mv misc/k8s/kustomization/base/secrets/dockerconfig/config.json misc/k8s/kustomization/base/secrets/dockerconfig/.dockerconfigjson
|
|
|
|
mkdir -p misc/k8s/kustomization/overlays/dev/secrets/dockerconfig
|
|
|
|
cp misc/k8s/kustomization/base/secrets/dockerconfig/.dockerconfigjson misc/k8s/kustomization/overlays/dev/secrets/dockerconfig/.dockerconfigjson
|
|
|
|
```
|
2024-02-19 11:01:01 +01:00
|
|
|
|
2024-02-15 15:15:41 +01:00
|
|
|
## Getting started with Kind
|
|
|
|
|
|
|
|
1. Create your [Kind](https://kind.sigs.k8s.io/) cluster
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
kind create cluster --config misc/k8s/kind/bouncer-cluster.yaml
|
|
|
|
```
|
2024-02-15 15:15:41 +01:00
|
|
|
|
|
|
|
2. Deploy required operators
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
kubectl apply -k misc/k8s/kind/cluster --server-side
|
|
|
|
```
|
2024-02-15 15:15:41 +01:00
|
|
|
|
|
|
|
3. Deploy your Bouncer development environment
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
skaffold dev -p dev --cleanup=false --default-repo reg.cadoles.com/<YOUR_PERSONNAL_USER_NAME>
|
|
|
|
```
|
2024-02-15 15:15:41 +01:00
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
Bouncer will automatically create proxies based on the files present in the `misc/k8s/kustomization/overlays/dev/files/bouncer/bootstrap.d` folder.
|
|
|
|
|
|
|
|
By default, with you host web browser, open http://localhost:9000, you should see the Cadoles website.
|
|
|
|
|
|
|
|
### Using the admin API
|
|
|
|
|
2024-02-15 15:15:41 +01:00
|
|
|
1. Open shell in bouncer-admin pod
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
kubectl exec -it -n bouncer-dev bouncer-admin-<suffix> -- /bin/sh
|
|
|
|
```
|
2024-02-15 15:15:41 +01:00
|
|
|
|
|
|
|
2. Create an authentication token
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
bouncer --config /etc/bouncer/config.yml auth create-token --role writer --subject $(whoami) > .bouncer-token
|
|
|
|
```
|
2024-02-15 15:15:41 +01:00
|
|
|
|
|
|
|
3. Create a proxy and enable it
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
```shell
|
|
|
|
bouncer admin proxy query
|
|
|
|
```
|
2024-02-15 15:15:41 +01:00
|
|
|
|
|
|
|
## Benchmarking
|
|
|
|
|
|
|
|
You can use [`siege`](https://github.com/JoeDog/siege) to benchmark your instance with the Cadoles proxy.
|
|
|
|
|
|
|
|
```shell
|
2024-03-26 17:28:38 +01:00
|
|
|
BASE_URL=http://localhost:9000 make siege
|
2024-02-15 15:15:41 +01:00
|
|
|
```
|