bitcoin-stack

by kriegalex

Helm chartv1.0.1App 27.2Verified publisher

A Helm chart for deploying a full Bitcoin stack: bitcoind, and more to come.

About this chart

Bitcoin Core Chart

A Helm chart for deploying a full Bitcoin stack: bitcoind, and more to come.

Prerequisites

Before deploying this chart, ensure your Kubernetes cluster meets the following requirements:

  1. Kubernetes 1.19+ – This chart uses features that are supported on Kubernetes 1.19 and above.
  2. Helm 3.0+ – Helm 3 is required to manage and deploy this chart.
  3. Persistent storage – Bitcoin Core requires significant disk space for blockchain data.

Installation

Helm

  1. Add the Helm chart repo
helm repo add k8s-charts https://kriegalex.github.io/k8s-charts/
helm repo update
  1. Inspect & modify the default values (optional)
helm show values k8s-charts/bitcoin-stack > custom-values.yaml
  1. Install the chart
helm upgrade --install bitcoin-stack k8s-charts/bitcoin-stack --values custom-values.yaml

Using Different Bitcoin Core Images

This chart is designed to work primarily with the blockstream/bitcoind image, but it can be adapted to work with other Bitcoin Core images by adjusting the paths configuration in your values file:

# Example for using a different Bitcoin Core image
image:
  repository: ruimarinho/bitcoin-core
  tag: "27.2"

bitcoind:
  dataDir: "/home/bitcoin/.bitcoin"  # Adjust based on the image's data directory
  configFile: "/home/bitcoin/.bitcoin/bitcoin.conf"  # Adjust based on the image's config path

Note: While this chart allows for using alternative Bitcoin Core images, compatibility is not guaranteed. Different images may:

  • Have different environment variable expectations
  • Use different directory structures
  • Have different startup parameters

You may need to customize additional settings or even modify the templates for complete compatibility with alternative images.

Accessing Bitcoin Core

RPC Access

To access the Bitcoin Core RPC from within the cluster:

kubectl exec -it sts/bitcoin-stack-0 -- bitcoin-cli -rpcuser=YOUR_RPC_USER -rpcpassword=YOUR_RPC_PASSWORD getblockchaininfo

To retrieve the auto-generated RPC password (if not manually set):

kubectl get secret bitcoin-stack-auth -o jsonpath="{.data.RPC_PASSWORD}" | base64 --decode

Port Forwarding

For local access to Bitcoin Core:

# For RPC access (HTTP)
kubectl port-forward sts/bitcoin-stack-0 8332:8332

# For P2P network access (TCP)
kubectl port-forward sts/bitcoin-stack-0 8333:8333

Storage Considerations

Bitcoin Core requires significant storage for the full blockchain:

  • Bitcoin Mainnet: 700+ GB (and growing)
  • Bitcoin Testnet: 50+ GB (and growing)

Ensure your persistent volume has adequate capacity. The StatefulSet uses volumeClaimTemplates to provision storage:

persistence:
  size: 700Gi  # Adjust according to your needs

Advanced Configuration

Network Types

This chart supports all three Bitcoin network types:

  • Mainnet (default): The main Bitcoin network
  • Testnet: Test network for development
  • Regtest: Local regression testing

To enable testnet:

bitcoind:
  testnet: true

To enable regtest:

bitcoind:
  regtest: true

Storage Optimization

For nodes with limited storage, you can enable pruning:

bitcoind:
  pruning: true
  prunesize: 1000  # Size in MiB to target (minimum 550)

Performance Tuning

For better performance, especially on nodes with more resources:

bitcoind:
  dbCache: 4096  # Allocate 4GB for database cache
  sync:
    parallelblocks: 16  # Download more blocks in parallel (1-16)
    maxconnections: 125  # Maximum connections to maintain

Advanced Indexing

Enable additional indexes for specific use cases:

bitcoind:
  txIndex: true              # Full transaction index
  blockfilterIndex: true     # Compact block filters (BIP158)
  coinstatsIndex: true       # Coinstats index for faster balance calculations

Initial Sync Optimization

For faster initial synchronization, you can use assumevalid:

bitcoind:
  sync:
    assumevalid: "00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad"  # Recent block hash

Values

KeyTypeDefaultDescription
affinityobject{}Affinity for pod assignment
bitcoind.configstring""bitcoin.conf file content @description -- If provided, this will be mounted as a configuration file. The user and password come from the secret and are passed directly to the command.
bitcoind.configFilestring"/root/.bitcoin/bitcoin.conf"Path where bitcoin.conf should be mounted when using custom config Replaces conf in the configuration file
bitcoind.dataDirstring"/root/.bitcoin"Directory where Bitcoin Core stores blockchain data Replaces datadir in the configuration file
bitcoind.regtestint0Enable regtest mode (local testing)
bitcoind.rpc.passwordstring""Password for RPC authentication @description -- If not provided, a random password will be generated
bitcoind.rpc.portint8333Port for P2P connections
bitcoind.rpc.rpcPortint8332Port for RPC interface
bitcoind.rpc.userstring"btc"Username for RPC authentication
bitcoind.testnetint0Enable testnet instead of mainnet
diagnosticMode.args[0]string"infinity"
diagnosticMode.command[0]string"sleep"
diagnosticMode.enabledboolfalse
fullnameOverridestring""String to fully override bitcoin-core.fullname template
image.pullPolicystring"IfNotPresent"Image pull policy
image.repositorystring"blockstream/bitcoind"Docker repository for Bitcoin Core image
image.tagstring""Overrides the image tag whose default is the chart appVersion
imagePullSecretslist[]Image pull secrets for private Docker registry
ingress.annotationsobject{}Ingress annotations
ingress.classNamestring""Ingress class name
ingress.enabledboolfalseEnable ingress for Bitcoin Core RPC
ingress.hostslist[{ host: bitcoin-rpc.local }]Ingress hosts configuration
ingress.tlslist[]Ingress TLS configuration
metrics.enabledboolfalseEnable Prometheus metrics exporter sidecar
metrics.imagestring"prometheuscommunity/bitcoin-exporter:latest"Container image for metrics
metrics.portint9332Metrics container port
metrics.pullPolicystring"IfNotPresent"Metrics image pull policy
metrics.resourcesobject{"limits":{"cpu":"200m","memory":"256Mi"},"requests":{"cpu":"100m","memory":"128Mi"}}Resources for metrics container
metrics.serviceAnnotationsobject{"prometheus.io/port":"9332","prometheus.io/scrape":"true"}Metrics service annotations
metrics.servicePortint9332Metrics service port
nameOverridestring""String to partially override bitcoin-core.fullname template
networkPolicy.allowIngressControllerboolfalseAllow Ingress controller to connect to Bitcoin RPC when using Ingress
networkPolicy.enabledboolfalseEnable network policy for Bitcoin Core
networkPolicy.ingressControllerNamespaceLabelstring"kubernetes.io/metadata.name"Label key used to identify the Ingress controller namespace
networkPolicy.ingressControllerNamespaceLabelValuestring"ingress-nginx"Label value used to identify the Ingress controller namespace
networkPolicy.p2pAllowFromlist[]Define which pods can access the Bitcoin P2P interface Leave empty to allow all pods to connect to P2P network
networkPolicy.rpcAllowFromlist[]Define which pods can access the Bitcoin RPC interface
nodeSelectorobject{}Node selector for pod assignment
persistence.accessModeslist["ReadWriteOnce"]Access modes for the PVC
persistence.annotationsobject{}Annotations for the PVC
persistence.enabledbooltrueEnable persistent storage for blockchain data
persistence.existingClaimstring""Use an existing PVC
persistence.sizestring"700Gi"Size of the PVC for blockchain data
persistence.storageClassstring""Storage class for the blockchain PVC @description -- If defined, storageClass: If set to "-", storageClass: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner
podAnnotationsobject{}Annotations to add to pods
podDisruptionBudget.enabledboolfalseEnable PDB
podDisruptionBudget.maxUnavailablestringnilMaximum unavailable pods
podDisruptionBudget.minAvailableint1Minimum available pods
podSecurityContext.enabledboolfalseEnable pod security context
podSecurityContext.fsGroupint1000Group ID to run the pod
probes.liveness.enabledboolfalseEnable liveness probe
probes.liveness.failureThresholdint3Failure threshold
probes.liveness.initialDelaySecondsint60Initial delay seconds
probes.liveness.periodSecondsint30Period seconds
probes.liveness.timeoutSecondsint5Timeout seconds
probes.readiness.enabledboolfalseEnable readiness probe
probes.readiness.failureThresholdint3Failure threshold
probes.readiness.initialDelaySecondsint30Initial delay seconds
probes.readiness.periodSecondsint10Period seconds
probes.readiness.successThresholdint1Success threshold
probes.readiness.timeoutSecondsint5Timeout seconds
probes.startup.enabledboolfalseEnable startup probe
probes.startup.failureThresholdint30Failure threshold
probes.startup.initialDelaySecondsint30Initial delay seconds
probes.startup.periodSecondsint10Period seconds
probes.startup.timeoutSecondsint5Timeout seconds
resourcesobject{}Resource requests and limits
securityContext.enabledboolfalseEnable security context
securityContext.readOnlyRootFilesystemboolfalseAllow write access to root filesystem
securityContext.runAsNonRootbooltrueEnsures container is not run as root
securityContext.runAsUserint1000User ID to run the container
service.typestring"ClusterIP"Service type
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
tolerationslist[]Tolerations for pod assignment
topologySpreadConstraintslist[]Topology spread constraints for pod distribution
volumePermissions.enabledboolfalseEnable an init container to set volume permissions
volumePermissions.imagestring"busybox"Image to use for volume permissions init container
volumePermissions.pullPolicystring"IfNotPresent"Image pull policy for init container
volumePermissions.securityContextobject{"enabled":true,"runAsUser":0}Security context for volume permissions init container

Deploy bitcoin-stack with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has bitcoin-stack on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartbitcoin-stack is pinned at v1.0.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply