Skip to content

Commit 3717e95

Browse files
committed
chore: nginx-files prod
1 parent e072876 commit 3717e95

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed

docs/helm.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,134 @@ Nginx with internal write, external readonly for file publication
541541
```sh
542542
helm upgrade --install files infrastructure/helm/nginx-files/nginx-fileserver --namespace core --values infrastructure/helm/nginx-files/values.yaml
543543
```
544+
PROD:
545+
```sh
546+
helm upgrade --install files infrastructure/helm/nginx-files/nginx-fileserver --namespace core \
547+
--values infrastructure/helm/nginx-files/values.yaml \
548+
--values infrastructure/helm/nginx-files/values.prod.yaml
549+
```
550+
551+
### MinIO
552+
553+
https://artifacthub.io/packages/helm/minio/minio
554+
555+
Single-node object storage with public GET access and pomerium-protected console.
556+
557+
> [!IMPORTANT]
558+
> Requires the EFS StorageClass. Apply it before deploying MinIO:
559+
> ```sh
560+
> kubectl apply -f infrastructure/helm/aws-storage-class/efs.yaml
561+
> ```
562+
563+
```sh
564+
helm repo add minio https://charts.min.io
565+
```
566+
567+
#### Create the credentials secret
568+
```sh
569+
ROOT_USER=minioadmin
570+
ROOT_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24)
571+
572+
kubectl create secret generic minio-credentials \
573+
--namespace core \
574+
--from-literal=rootUser="$ROOT_USER" \
575+
--from-literal=rootPassword="$ROOT_PASSWORD"
576+
```
577+
578+
#### Deploy
579+
```sh
580+
helm upgrade --install minio minio/minio \
581+
--namespace core \
582+
--values infrastructure/helm/minio/values.yaml
583+
```
584+
585+
#### Bucket management via mc
586+
587+
> [!NOTE]
588+
> The MinIO console (web UI) is an object browser only. Bucket administration is done via `mc` CLI.
589+
590+
```sh
591+
# Start a temporary mc pod
592+
export ROOT_PASSWORD=$(kubectl get secret minio-credentials -n core -o jsonpath='{.data.rootPassword}' | base64 -d)
593+
594+
kubectl run mc-admin --rm -it --restart=Never --namespace core \
595+
--image=quay.io/minio/mc:latest --env="ROOT_PW=$ROOT_PASSWORD" -- sh -c '
596+
mc alias set myminio http://minio:9000 minioadmin $ROOT_PW && sh'
597+
```
598+
599+
Common operations inside the mc pod:
600+
```sh
601+
# Create a bucket
602+
mc mb myminio/my-bucket
603+
604+
# Set anonymous download (public GET)
605+
mc anonymous set download myminio/my-bucket
606+
607+
# Check bucket policy
608+
mc anonymous get myminio/my-bucket
609+
610+
# Enable versioning
611+
mc version enable myminio/my-bucket
612+
613+
# List buckets
614+
mc ls myminio/
615+
616+
# List bucket contents
617+
mc ls myminio/my-bucket/
618+
```
619+
620+
#### Accessing files
621+
622+
**Public GET (anonymous, no auth needed):**
623+
```sh
624+
# Via external ingress
625+
curl https://bucket.dev.testingmachine.eu/public/path/file.txt
626+
627+
# Via internal service
628+
curl http://minio.core.svc:9000/public/path/file.txt
629+
```
630+
631+
**S3-compatible upload (authenticated, from within the cluster):**
632+
633+
Using `mc`:
634+
```sh
635+
mc cp myfile.txt myminio/public/path/myfile.txt
636+
637+
echo "data" | mc pipe myminio/public/path/myfile.txt
638+
```
639+
640+
Using Python (boto3):
641+
```python
642+
import boto3
643+
644+
s3 = boto3.client(
645+
"s3",
646+
endpoint_url="http://minio.core.svc:9000",
647+
aws_access_key_id="minioadmin",
648+
aws_secret_access_key="<from secret>",
649+
)
650+
651+
# Upload
652+
s3.put_object(Bucket="public", Key="path/file.txt", Body=b"hello")
653+
654+
# Download
655+
obj = s3.get_object(Bucket="public", Key="path/file.txt")
656+
print(obj["Body"].read().decode())
657+
```
658+
659+
Using curl with HTTP (authenticated via query params with presigned URL):
660+
```sh
661+
# Generate a presigned PUT URL (valid 1h)
662+
mc share upload --expire 1h myminio/public/path/file.txt
663+
# outputs a curl command with signed URL, e.g.:
664+
# curl https://minio:9000/public/path/file.txt?X-Amz-Algorithm=... -F file=@/path/to/file
665+
666+
# Generate a presigned GET URL
667+
mc share download --expire 1h myminio/public/path/file.txt
668+
```
669+
670+
> [!NOTE]
671+
> Anonymous PUT is blocked by bucket policy. Internal services must authenticate using S3 credentials from the `minio-credentials` secret, or use presigned URLs.
544672
545673
## Preserve important volumes:
546674
Default storageclasses set `reclaimPolicy: Delete`, which means that deleting the PVC can accidentally delete your volume underneath.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
nameOverride: nginx
2+
3+
ingress:
4+
host: files.opendatahub.com
5+
6+
replicaCount: 2
7+
8+
persistence:
9+
size: 20Gi

0 commit comments

Comments
 (0)