diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-04-05 15:04:27 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-04-07 16:12:35 +0200 |
commit | 7e1ac51b580afa8e900206e7cc49791ed0a00d94 (patch) | |
tree | 2a0467b90a2b1ccb716a0e7555f033246367f035 | |
parent | 94f1e48fff7652f6b7195fea4570d3fa8b5c98f6 (diff) | |
download | garage-7e1ac51b580afa8e900206e7cc49791ed0a00d94.tar.gz garage-7e1ac51b580afa8e900206e7cc49791ed0a00d94.zip |
Add files to quickly test k8s
-rw-r--r-- | script/k8s/README.md | 13 | ||||
-rw-r--r-- | script/k8s/admin.yaml | 12 | ||||
-rw-r--r-- | script/k8s/config.yaml | 30 | ||||
-rw-r--r-- | script/k8s/daemon.yaml | 52 |
4 files changed, 107 insertions, 0 deletions
diff --git a/script/k8s/README.md b/script/k8s/README.md new file mode 100644 index 00000000..4231d3aa --- /dev/null +++ b/script/k8s/README.md @@ -0,0 +1,13 @@ +Spawn a cluster with minikube + +```bash +minikube start +minikube kubectl -- apply -f config.yaml +minikube kubectl -- apply -f daemon.yaml +minikube dashboard + +minikube kubectl -- exec -it garage-0 --container garage -- /garage status +# etc. +``` + + diff --git a/script/k8s/admin.yaml b/script/k8s/admin.yaml new file mode 100644 index 00000000..af8b54d5 --- /dev/null +++ b/script/k8s/admin.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: garage-admin +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: +- apiGroup: rbac.authorization.k8s.io + kind: User + name: system:serviceaccount:default:default diff --git a/script/k8s/config.yaml b/script/k8s/config.yaml new file mode 100644 index 00000000..8cf40fc2 --- /dev/null +++ b/script/k8s/config.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: garage-config + namespace: default +data: + garage.toml: |- + metadata_dir = "/tmp/meta" + data_dir = "/tmp/data" + + replication_mode = "3" + + rpc_bind_addr = "[::]:3901" + rpc_secret = "1799bccfd7411eddcf9ebd316bc1f5287ad12a68094e1c6ac6abde7e6feae1ec" + + bootstrap_peers = [] + + kubernetes_namespace = "default" + kubernetes_service_name = "garage-daemon" + kubernetes_skip_crd = false + + [s3_api] + s3_region = "garage" + api_bind_addr = "[::]:3900" + root_domain = ".s3.garage.tld" + + [s3_web] + bind_addr = "[::]:3902" + root_domain = ".web.garage.tld" + index = "index.html" diff --git a/script/k8s/daemon.yaml b/script/k8s/daemon.yaml new file mode 100644 index 00000000..fedc46e0 --- /dev/null +++ b/script/k8s/daemon.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: garage +spec: + selector: + matchLabels: + app: garage + serviceName: "garage" + replicas: 3 + template: + metadata: + labels: + app: garage + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: garage + image: dxflrs/amd64_garage:v0.7.0-rc1 + ports: + - containerPort: 3900 + name: s3-api + - containerPort: 3902 + name: web-api + volumeMounts: + - name: fast + mountPath: /mnt/fast + - name: slow + mountPath: /mnt/slow + - name: etc + mountPath: /etc/garage.toml + subPath: garage.toml + volumes: + - name: etc + configMap: + name: garage-config + volumeClaimTemplates: + - metadata: + name: fast + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 100Mi + - metadata: + name: slow + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 100Mi + |