Skip to content

blockchain-etl/blockchain-kubernetes

Repository files navigation

blockchain-kubernetes

Kubernetes manifests for running cryptocurrency nodes.

Here is quick HOWTO deploy nodes into GKE env.

Requirements

  • linux/macos terminal
  • git
  • gcloud
  • kubectl (version from gcloud is ok)
  • helm
  • follow "Before you begin" part of GCP manual

Deploy

export PROJECT_ID=$(gcloud config get-value project)
export REGION=us-central1

gcloud compute addresses create dev-btc-0 --region $REGION  --project=$PROJECT_ID
gcloud compute addresses create dev-eth-0 --region $REGION  --project=$PROJECT_ID
gcloud compute addresses create dev-btc-1 --region $REGION  --project=$PROJECT_ID
gcloud compute addresses create dev-eth-1 --region $REGION  --project=$PROJECT_ID

gcloud compute addresses list --project=$PROJECT_ID
  • Adjust zones in regional storage classes sc-ssd-regional.yaml and sc-standard-regional.yaml, use the same zones as you used with GKE cluster.
  • Create storage classes, replace K8S_CONTEXT with real value.
export K8S_CONTEXT=baas0
kubectl --context $K8S_CONTEXT create -f sc-ssd.yaml 
kubectl --context $K8S_CONTEXT create -f sc-ssd-regional.yaml
kubectl --context $K8S_CONTEXT create -f sc-standard-regional.yaml
  • Copy example-values-parity.yaml and example-values-bitcoind.yaml to values-parity.yaml and values-bitcoind.yaml
cp example-values-parity.yaml values-parity.yaml
cp example-values-bitcoind.yaml values-bitcoind.yaml
  • Adjust values-parity.yaml and values-bitcoind.yaml, pay attention to resource requests and limits, IP adresses, volume size, and RPC credentials. Replace 198.51.100.0 and 203.0.113.0 with real IP values of allocated adresses.
export EDITOR=vi
$EDITOR values-bitcoind.yaml
$EDITOR values-parity.yaml
  • Deploy cryptonodes
helm --kube-context $K8S_CONTEXT install charts/parity/ --namespace dev-eth-0 --name dev-eth-0 --values values-parity.yaml
helm --kube-context $K8S_CONTEXT install charts/bitcoind/ --namespace dev-btc-0 --name dev-btc-0 --values values-bitcoind.yaml
  • Use kubectl describe to check/troubleshoot, for example:
kubectl --context $K8S_CONTEXT --namespace dev-eth-0 describe statefulset dev-eth-0-parity
kubectl --context $K8S_CONTEXT --namespace dev-eth-0 describe pod dev-eth-0-parity-0

Please check separate file for more details about additional troubleshooting.

TIP: when you need archive parity node to sync up faster - get a tons of RAM and preload synced blockchain into OS cache. My case was 640GB of RAM and blockchain preload from inside container via find | xargs cat > /dev/null or vmtouch, 3-5x speedup from 0.5-2 blocks/sec(100-200 tx/sec) to 7-10 blocks/sec (700-1000 tx/sec) and sustained blockchain write near 150MB/s, just $1/hour with preemptible nodes.

Charts repository

You can use Cloud Build to update chart repository with these charts