mev-toolkit/geth_and_k8s/deployment_gcp_k8s.md
2022-02-25 16:17:29 +01:00

903 B

Deployment of geth in GCP + Kubernetes

Deployment

NAMESPACE=ethereum
kubectl create namespace ${NAMESPACE}
kubectl apply --filename=deployment.yaml --namespace=${NAMESPACE}

Accessing node without opening firewall

SERVICE=ethereum
NAMESPACE=ethereum

NODE=$(\
  kubectl get nodes \
  --output=jsonpath='{.items[0].metadata.name}')

PORT=$(\
  kubectl get services/${SERVICE} \
  --namespace=${NAMESPACE} \
  --output=jsonpath='{.spec.ports[?(@.name=="default")].nodePort}')

echo ${PORT}

gcloud compute ssh <docker container alias> \
--ssh-flag="-L ${PORT}:localhost:${PORT}" \
--project=<project name>

Member connecting

docker run \
--rm \
--interactive \
--tty  \
--net=host \
ethereum/client-go attach http://localhost:${PORT}

Dealing with secrets

kubectl create secret generic keystore \
--from-file=path/to/keystore \
--namespace=$NAMESPACE