Skip to main content
Version: 1.6

Kubernetes

Run FastBCP on any Kubernetes cluster (K3s, AKS, EKS, GKE, OpenShift…) as a Job: one export per Job, with the FastBCP Docker image. The license and the credentials stay in Kubernetes Secrets, so any secret store that can deliver a Secret works without change.

Overview​

ItemValue
WorkloadA Job (batch/v1) with restartPolicy: Never, or a CronJob for scheduled exports
Imagearpeio/fastbcp:<version>: tags, volumes and logging settings in Docker
LicenseA Secret mounted as a read-only file, passed to --license
CredentialsSecrets read as environment variables
BackupsFor backup sources, a read-only volume with the backup files and a volume for their index
ResultThe Job status follows the FastBCP exit code; the run log is in kubectl logs

Prerequisites​

  1. Create the SecretsThe license file, the database credentials and the cloud credentials
  2. Run the JobThe license mounted as a read-only file, the credentials passed from the Secrets
  3. Check the resultThe Job status and the FastBCP log

1. Create the Secrets​

# License file and database credentials
kubectl create secret generic fastbcp-license --from-file=FastBCP.lic=./FastBCP.lic
kubectl create secret generic fastbcp-db \
--from-literal=user=FastUser \
--from-literal=password='FastPassword'

# Cloud credentials read by FastBCP from the environment
kubectl create secret generic aws-credentials \
--from-literal=AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
--from-literal=AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
--from-literal=AWS_REGION="${AWS_REGION}"
Good to know

For S3-compatible storage (MinIO, SeaweedFS…), add the endpoint to the same Secret: --from-literal=S3_ENDPOINT="http://<host>:<port>". See AWS S3.

2. Run the Job​

A SQL Server table exported to Parquet files on S3, in 12 parallel chunks:

fastbcp-orders-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: fastbcp-orders-export
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: fastbcp
image: arpeio/fastbcp:vX.Y.Z # pin the version you have tested
env:
- name: DB_USER
valueFrom:
secretKeyRef: { name: fastbcp-db, key: user }
- name: DB_PASSWORD
valueFrom:
secretKeyRef: { name: fastbcp-db, key: password }
envFrom:
- secretRef:
name: aws-credentials
args:
- --license
- /secrets/fastbcp/FastBCP.lic
- --connectiontype
- mssql
- --server
- sqlserver.data.svc.cluster.local,1433
- --database
- tpch_test
- --user
- $(DB_USER)
- --password
- $(DB_PASSWORD)
- --query
- SELECT * FROM dbo.orders WHERE year(o_orderdate)=1998
- --fileoutput
- orders.parquet
- --directory
- s3://arpeioftoutput/k8stest/
- --parallelmethod
- Ntile
- --distributekeycolumn
- o_orderkey
- --paralleldegree
- "12"
- --merge
- "false"
- --runid
- orders_export_k8s
volumeMounts:
- name: fastbcp-license
mountPath: /secrets/fastbcp
readOnly: true
volumes:
- name: fastbcp-license
secret:
secretName: fastbcp-license
kubectl apply -f fastbcp-orders-job.yaml
  • License as a fileThe Secret is mounted under /secrets/fastbcp and its path is passed to --license. The license stays out of the Job definition and of the process arguments.
  • Credentials from Secretsenv and envFrom turn Secret keys into environment variables. FastBCP reads the cloud credentials from the environment itself.
  • $(VAR) in argsThe entrypoint of the image is the FastBCP binary, not a shell, so $VAR is not expanded. Kubernetes replaces $(VAR) with the variable before the container starts.
Good to know

Numbers and booleans in args are quoted ("12", "false"): Kubernetes only accepts strings there.

3. Check the Result​

kubectl logs -f job/fastbcp-orders-export
kubectl get job fastbcp-orders-export
FastBCP exit codeJob status
0Complete
Any other code, such as 99 (no or invalid license) or 100 (expired license)Failed; with backoffLimit: 0, the export is not run again

The log ends with the totals of the run (Total data rows, Total time) and Completed Load. Add --runid to find a run in the log; for other log destinations, see Configuring FastBCP Logging.

Schedule with a CronJob​

Put the spec of the Job under jobTemplate, unchanged:

fastbcp-orders-cronjob.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: fastbcp-orders-nightly
spec:
schedule: "0 2 * * *" # every day at 02:00
concurrencyPolicy: Forbid # no new run while the previous one is running
jobTemplate:
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: fastbcp
# image, env, envFrom, args and volumeMounts of the Job
volumes:
# volumes of the Job

To run it now, without waiting for the schedule:

kubectl create job --from=cronjob/fastbcp-orders-nightly fastbcp-orders-now

Backup Sources​

With --connectiontype backup_mssql or backup_rman, FastBCP reads SQL Server backup files or Oracle RMAN backup sets, with no database server. The pod needs two volumes:

/backupsRead-only

The backup files, from the claim of your backup share (NFS, SMB, Azure Files, a cloud disk…). --server names this directory, --database the files.

/indexRead-write, kept between runs

The index of the backups, named by FASTBCP_INDEX_DIR. The first export from a backup reads its structure, which can take minutes on a large compressed backup; the next exports from the same backup open in milliseconds. Without a persistent volume, the index goes with the pod and every run reads the structure again.

fastbcp-backup-job.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: fastbcp-index
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 2Gi
---
apiVersion: batch/v1
kind: Job
metadata:
name: fastbcp-backup-export
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
securityContext:
fsGroup: 10001 # group of the image user: makes the index volume writable
fsGroupChangePolicy: OnRootMismatch
containers:
- name: fastbcp
image: arpeio/fastbcp:vX.Y.Z # pin the version you have tested
env:
- name: FASTBCP_INDEX_DIR
value: /index
envFrom:
- secretRef:
name: aws-credentials
args:
- --license
- /secrets/fastbcp/FastBCP.lic
- --connectiontype
- backup_mssql
- --server
- /backups
- --database
- "tpch_test_*.bak"
- --sourceschema
- dbo
- --sourcetable
- orders
- --fileoutput
- orders.parquet
- --directory
- s3://arpeioftoutput/k8sbackup/
- --parallelmethod
- Physical
- --paralleldegree
- "4"
- --runid
- orders_backup_export_k8s
volumeMounts:
- name: fastbcp-license
mountPath: /secrets/fastbcp
readOnly: true
- name: backups
mountPath: /backups
readOnly: true
- name: index
mountPath: /index
volumes:
- name: fastbcp-license
secret:
secretName: fastbcp-license
- name: backups
persistentVolumeClaim:
claimName: mssql-backups # the claim of your backup share
readOnly: true
- name: index
persistentVolumeClaim:
claimName: fastbcp-index
Good to know
  • The image runs as the user fastbcp, uid and gid 10001. It must be able to read the backup files: through their permissions, or with supplementalGroups in the securityContext naming their group.
  • fsGroup: 10001 makes the index volume writable, for the volume types that support it. If the index cannot be written, the export still runs and logs Backup index not saved: cannot write to /index: see When the index cannot be saved.
  • A ReadWriteOnce claim is mounted by the pods of one node at a time.
  • For Oracle RMAN backup sets, use the same volumes with --connectiontype backup_rman: --server names the directory of the backup pieces.

Use a Secret Store​

FastBCP reads its license from a file path, an HTTPS URL or the license content (--license); it does not connect to secret stores itself. The cluster brings the secret to the pod, in one of three ways:

MethodWhat the pod getsWhat changes in the Job
External Secrets OperatorA Kubernetes Secret, kept in sync with the storeNothing
Secrets Store CSI DriverA file, from a csi volumeThe license volume, and a service account
Vault Agent InjectorA file in /vault/secretsAnnotations, a service account and the --license path

The examples use HashiCorp Vault: the license is stored at secret/fastbcp/license, key content, and the Vault role fastbcp is bound to the Kubernetes service account fastbcp. With Azure Key Vault, AWS Secrets Manager or Google Secret Manager, only the store (External Secrets Operator) or the provider (CSI driver) changes: see their documentation.

The Vault side of these examples
# The license file, in the KV v2 engine mounted at secret/
vault kv put secret/fastbcp/license content=- < FastBCP.lic

# Kubernetes authentication, a read-only policy and a role for the fastbcp service account
vault auth enable kubernetes
vault write auth/kubernetes/config kubernetes_host=https://kubernetes.default.svc:443
vault policy write fastbcp - <<'EOF'
path "secret/data/fastbcp/*" {
capabilities = ["read"]
}
EOF
vault write auth/kubernetes/role/fastbcp \
bound_service_account_names=fastbcp \
bound_service_account_namespaces=default \
policies=fastbcp ttl=1h

kubectl create serviceaccount fastbcp

External Secrets Operator​

The operator copies the license from the store into the Kubernetes Secret fastbcp-license, and refreshes it. The Job does not change: it mounts that Secret as before.

fastbcp-license-externalsecret.yaml
apiVersion: external-secrets.io/v1
kind: ClusterSecretStore
metadata:
name: vault
spec:
provider:
vault:
server: http://vault.vault.svc:8200
path: secret
version: v2
auth:
kubernetes:
mountPath: kubernetes
role: fastbcp
serviceAccountRef:
name: fastbcp
namespace: default
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: fastbcp-license
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: vault
target:
name: fastbcp-license # the Secret the Job mounts
data:
- secretKey: FastBCP.lic
remoteRef:
key: fastbcp/license
property: content
kubectl apply -f fastbcp-license-externalsecret.yaml
kubectl get externalsecret fastbcp-license # STATUS: SecretSynced

Remove a fastbcp-license Secret created by hand first: the operator creates its own. The same way, an ExternalSecret can fill the Secrets of the database credentials and of the cloud credentials.

Secrets Store CSI Driver​

The driver mounts the license as a file, read from the store when the pod starts. Describe the file in a SecretProviderClass:

fastbcp-license-secretproviderclass.yaml
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: fastbcp-license
spec:
provider: vault
parameters:
vaultAddress: http://vault.vault.svc:8200
roleName: fastbcp
objects: |
- objectName: FastBCP.lic
secretPath: secret/data/fastbcp/license
secretKey: content

In the Job, run the pod as the service account the store trusts, and replace the secret volume with a csi volume. The mount path does not change, nor does --license /secrets/fastbcp/FastBCP.lic:

  template:
spec:
restartPolicy: Never
serviceAccountName: fastbcp
containers:
# ... unchanged
volumes:
- name: fastbcp-license
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: fastbcp-license

Vault Agent Injector​

The injector adds an init container that writes the license to /vault/secrets before FastBCP starts. Add the annotations and the service account to the pod template, drop the fastbcp-license volume and its mount, and point --license to the file:

  template:
metadata:
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-pre-populate-only: "true" # init container only: the Job can complete
vault.hashicorp.com/role: fastbcp
vault.hashicorp.com/agent-inject-secret-fastbcp.lic: secret/data/fastbcp/license
vault.hashicorp.com/agent-inject-template-fastbcp.lic: |
{{- with secret "secret/data/fastbcp/license" -}}{{ .Data.data.content }}{{- end -}}
spec:
restartPolicy: Never
serviceAccountName: fastbcp
containers:
- name: fastbcp
image: arpeio/fastbcp:vX.Y.Z
args:
- --license
- /vault/secrets/fastbcp.lic
# ... the other arguments, unchanged
Good to know
  • agent-pre-populate-only keeps only the init container. Without it, the agent also runs as a sidecar that does not stop, and the Job never completes.
  • The agent writes the file name in lowercase: agent-inject-secret-FastBCP.lic gives /vault/secrets/fastbcp.lic. Name it in lowercase, as above.

Which One to Choose​

  • External Secrets Operator is the simplest default: one tool for the license and the passwords, and the Job stays the same.
  • Secrets Store CSI Driver keeps the license out of the Kubernetes Secrets: it only exists as a file in the pod.
  • Vault Agent Injector fits clusters where Vault and its injector already run.
Good to know
  • The database password and the cloud credentials reach FastBCP as environment variables, so they need a Kubernetes Secret: External Secrets Operator covers them as well as the license.
  • A renewed license only needs an update in the store, or of the Secret: no image rebuild, and the next Job uses it.
Copyright © 2026 Architecture & Performance.