|
| 1 | +--- |
| 2 | +sidebar_label: Epinio's SeaweedFS (S3) service |
| 3 | +sidebar_position: 30 |
| 4 | +title: Accessing Epinio's internal SeaweedFS S3 service |
| 5 | +description: How to access Epinio's internal SeaweedFS S3-compatible service |
| 6 | +keywords: [epinio, kubernetes, internal seaweedfs, s3 service] |
| 7 | +doc-type: [how-to] |
| 8 | +doc-topic: [epinio, how-to, other, access-s3-service] |
| 9 | +doc-persona: [epinio-developer] |
| 10 | +--- |
| 11 | + |
| 12 | +Epinio uses [SeaweedFS](https://github.com/seaweedfs/seaweedfs) as its default S3-compatible storage for application source code. |
| 13 | +You can expose the internal S3 API for debugging, for example using the Amazon Web Services (AWS) CLI or the MinIO Client (`mc`). |
| 14 | +In both cases you expose the internal service through a Kubernetes `NodePort` service. |
| 15 | + |
| 16 | +:::caution |
| 17 | + |
| 18 | +For security reasons, delete the exposed services when you finish debugging. |
| 19 | + |
| 20 | +::: |
| 21 | + |
| 22 | +## Access Epinio's S3 storage through the AWS CLI |
| 23 | + |
| 24 | +Expose the SeaweedFS S3 service and use the AWS CLI to talk to it. |
| 25 | + |
| 26 | +```bash |
| 27 | +# Expose the SeaweedFS S3 service (service name may vary; typically seaweedfs-s3) |
| 28 | +kubectl expose deployment seaweedfs-s3 -n epinio --name epinio-s3-np --port=8333 --type=NodePort |
| 29 | +# If the S3 component is a different workload type, use the appropriate resource (e.g. pod or service) |
| 30 | +PORT=$(kubectl get svc -n epinio epinio-s3-np -o jsonpath='{.spec.ports[0].nodePort}') |
| 31 | +NODE=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}") |
| 32 | +S3_KEY=$(kubectl get secrets/seaweedfs-creds -n epinio -o=go-template='{{index .data "accesskey" | base64decode}}') |
| 33 | +S3_SECRET=$(kubectl get secrets/seaweedfs-creds -n epinio -o=go-template='{{index .data "secretkey" | base64decode}}') |
| 34 | +``` |
| 35 | + |
| 36 | +Install the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) and configure it for the internal S3 endpoint: |
| 37 | + |
| 38 | +```bash |
| 39 | +aws configure set aws_access_key_id $S3_KEY |
| 40 | +aws configure set aws_secret_access_key $S3_SECRET |
| 41 | +aws configure set default.region us-east-1 |
| 42 | +echo "Usage: aws --no-verify-ssl --endpoint-url https://$NODE:$PORT s3 ls" |
| 43 | +``` |
| 44 | + |
| 45 | +To list the Epinio bucket: |
| 46 | + |
| 47 | +```bash |
| 48 | +aws --no-verify-ssl --endpoint-url https://$NODE:$PORT s3 ls s3://epinio/ |
| 49 | +``` |
| 50 | + |
| 51 | +When you are done, remove the NodePort service: |
| 52 | + |
| 53 | +```console |
| 54 | +kubectl delete service epinio-s3-np -n epinio |
| 55 | +``` |
| 56 | + |
| 57 | +## Access using MinIO Client (mc) |
| 58 | + |
| 59 | +You can also use the [MinIO Client](https://min.io/docs/minio/linux/reference/minio-mc.html) (`mc`), which works with any S3-compatible API. |
| 60 | +After exposing the S3 service as above, configure an alias and use `mc ls`, `mc cp`, etc. as needed. |
| 61 | + |
| 62 | +For more on S3-compatible access, see [AWS CLI S3](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) and [MinIO Client with S3](https://min.io/docs/minio/linux/integrations/aws-cli-with-minio.html). |
0 commit comments