GithubHelp home page GithubHelp logo

kubetrail / geth-deployment Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 2.0 19 KB

Kubernetes manifests for deploying geth in dev mode, i.e. an Ethereum proof-of-authority single node for testing purposes

License: Apache License 2.0

Dockerfile 4.65% Makefile 95.35%
ethereum geth geth-node metamask kubernetes-deployment

geth-deployment's Introduction

geth-deployment

Deploy geth to a k8s cluster in dev node running as an Ethereum single node testnet with proof-of-authority (PoA) consensus

disclaimer

The use of this tool does not guarantee security or usability for any particular purpose. Please review the code and use at your own risk.

installation

first download the code, build container image and push to your container registry.

please make sure go toolchain and docker are installed at relatively newer versions and also update the IMG value to point to your registry

export IMG=docker.io/your-account-name/geth:v1.10.16
make manifests
make docker-build
make docker-push

once the container image is available in your registry you can deploy geth to a kubernetes cluster.

make deploy

The status of k8s resources should appear as follows:

kubectl --namespace=geth-system get pods,svc,configmaps,secrets                                                                    dusy: Thu Mar  3 09:00:15 2022

NAME                                           READY   STATUS    RESTARTS   AGE
pod/geth-controller-manager-65dcc9f484-27dpt   1/1     Running   0          4m18s

NAME                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
service/geth-geth   ClusterIP   10.107.236.154   <none>        8545/TCP,8546/TCP   4m20s

NAME                         DATA   AGE
configmap/kube-root-ca.crt   1      4m20s

NAME                                         TYPE                                  DATA   AGE
secret/artifact-registry-key                 kubernetes.io/dockerconfigjson        1      4m20s
secret/default-token-m7tpn                   kubernetes.io/service-account-token   3      4m20s
secret/geth-controller-manager-token-lbn6t   kubernetes.io/service-account-token   3      4m20s

interact with the chain

Exec into the pod by running geth attach command as shown below:

make console
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.16-stable-20356e57/linux-arm64/go1.17.7
coinbase: 0x<address redacted>
at block: 1 (Thu Mar 03 2022 04:21:18 GMT+0000 (UTC))
 datadir: 
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d or type exit
> 

Transfer funds to an address:

> eth.sendTransaction({from:eth.coinbase, to:"0x62c1831A63069619EE94d73853C21ceD076d0665", value: web3.toWei(125, "ether")})

connect via Metamask

First, port-forward RPC

make port-forward-rpc
Forwarding from 127.0.0.1:8545 -> 8545
Forwarding from [::1]:8545 -> 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545
Handling connection for 8545

Metamask Chrome extension can be configured to connect to this network.

Note that Metamask smartphone app will not accept http only RPC addresses and therefore in such cases only Chrome extensions can be used. See more: MetaMask/metamask-mobile#2314 (comment)

Connection parameters, typically already setup as Localhost network:

At this point the funds transferred in previous should be visible in the Metamask wallet assuming you have configured Metamask with the same address.

linux and arm64 users:

First set env. var PROJECT to point to Google cloud project ID. Also make sure you have artifact registry API enabled and a repo called services has been provisioned for container images to reside in it.

podman can be used instead of docker to build and push multi-arch container images. First build amd64 and arm64 images separately on respective host machines with these host architectures.

make podman-build

Save/load container images and make sure both amd64 and arm64 images are present on the same machine for next step to link them togehter in a manifest.

make podman-push

This will push the container images to your registry and link them in a manifest.

references:

geth-deployment's People

Contributors

sdeoras avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.