prysm-pulse/k8s
terence tsao 7565fbe3b8 Mega Renovate Updates (#2068)
* Update dependency com_github_spf13_cobra to v0.0.3

* Update dependency com_github_allegro_bigcache to v1

* Update dependency com_github_hashicorp_go_multierror to v1

* Update dependency com_github_x_cray_logrus_prefixed_formatter to v0.5.2

* Update dependency com_github_fd_go_nat to v1

* Update dependency com_github_matttproud_golang_protobuf_extensions to v1

* Update dependency com_github_grpc_ecosystem_go_grpc_middleware to v1

* Update com_github_atlassian_bazel_tools commit hash to 986ed8f

* Update dependency bazel_skylib to v0.8.0

* Update dependency com_google_cloud_go to v0.37.1

* Update dependency io_opencensus_go to v0.19.2

* Update libp2p

* Update dependency com_github_go_yaml_yaml to v2

* Update dependency com_github_golang_mock to v1

* Update dependency com_github_google_uuid to v1

* Update dependency com_github_gorilla_websocket to v1

* Update dependency com_github_huin_goupnp to v1

* add thirft
2019-03-25 08:14:43 -05:00
..
beacon-chain Mega Renovate Updates (#2068) 2019-03-25 08:14:43 -05:00
geth Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
monitoring Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
tools Kubernetes - Part 3 of ?? (#981) 2018-11-28 00:27:21 -05:00
BUILD.bazel Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
letsencrypt-issuer.yaml k8s goerli config (#1517) 2019-02-08 15:30:38 -05:00
priority.yaml Kubernetes - Part 1 of ?? (#348) 2018-07-30 10:04:47 -04:00
prylabs-wildcard-gateway.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
README.md Update References to Deposit Contract, Update Flags (#1576) 2019-02-13 13:08:28 -06:00

Kubernetes Configuration for Ethereum Serenity

Requirements

  • Kubernetes v1.11+ (for PriorityClass)
  • Minikube (for now)

Starting minikube with v1.11

As of minikube 0.28.2, the default version of kubernetes is 1.10.0. In order to start a local cluster with v1.11.0, run the following:

minikube start --kubernetes-version=v1.11.0 --cpus 4

Istio

Be sure to update the loadBalancerIP and includeIPRanges as needed. Refer to this guide if necessary.

First download the release

curl -L https://git.io/getLatestIstio | sh -
helm install install/kubernetes/helm/istio --name istio --namespace istio-system --set grafana.enabled=true --set tracing.enabled=true --set gateways.istio-ingressgateway.loadBalancerIP=35.224.249.2 --set global.proxy.includeIPRanges="10.52.0.0/14\,10.55.240.0/20" --set kiali.enabled=true --set telemetry-gateway.grafanaEnabled=true 

Geth's Genesis file

This file is the default provided by geth-genesis secret.

{                                                                               
    "config": {                                                                 
        "chainId": 1337,                                                        
        "homesteadBlock": 0,                                                    
        "eip155Block": 0,                                                       
        "eip158Block": 0                                                        
    },                                                                          
    "difficulty": "0x0",                                                      
    "gasLimit": "0x2100000",                                                    
    "alloc": {                                                                  
       "717c3a6e4cbd476c2312612155eb233bf498dd5b":                              
         { "balance": "0x1337000000000000000000" }                             
    }                                                                           
}

The private key for the allocation above is:

783da8ef5343c3019748506305d400bca8c324a5819f3a7f7fbf0c0a0d799b09

NOTE: Obviously, do not use this wallet key for anything with real money on it!

To update the genesis secret, change value in geth/genesis.secret.yaml to the base64 encoded string for the genesis.json.

Example:

cat /tmp/genesis.json | json-minify | base64

Deploying Geth Mainchain

First, launch the bootnode so that geth nodes can discover each other.

bazel run //k8s/geth:bootnode.deploy.apply

Then launch everything else.

bazel run //k8s:everything.apply

This creates a few nodes and one miner with CPU restrictions. After ~30 minutes, the miner has generated the DAG and begins mining. The miners have a stateful volume for their DAGs so that they do not have to regenerate them on restart.

Note: DAG generation time can be improved by giving the miner more CPU in the deployment yaml.

Bootstrapping the Beacon Chain

TODO: This process is currently manual and needs to be improved!

Using the private key above and the deployContract tool, deploy the validator registration contract.

# get the address the node service
minikube service geth-nodes --url

Example response:

http://192.168.99.100:30051
http://192.168.99.100:31745

Using the first port provided (RPC). Run the deployContract tool

bazel run //contracts/deposit-contract/deployContract --\
  --privKey=783da8ef5343c3019748506305d400bca8c324a5819f3a7f7fbf0c0a0d799b09 \
  --httpPath=http://192.168.99.100:30051

Example output:

INFO main: New contract deployed address=0x541AfaC5266c534de039B4A1a53519e76ea82846

Set this value for the deposit contract addr flag in k8s/beacon-chain/beacon-chain.deploy.yaml.

Ensure that the beacon-chain and client docker images are up to date.

bazel run //beacon-chain:push_image
bazel run //client:push_image

Start the beacon chain nodes

bazel run //k8s/beacon-chain:everything.apply

Start the clients

bazel run //k8s/client:everything.apply

Accessing Geth Services

Check out the ethstats dashboard by querying minikube for the service URL.

minikube service geth-ethstats --url

Accessing the geth nodes.

minikube service geth-nodes --url

# Example output
http://192.168.99.100:30451
http://192.168.99.100:32164

The first URL will be the rpc endpoint and the second URL will be the websocket endpoint.

So we can use these values locally to connect to our local cluster.

bazel run //beacon-chain -- --web3provider=ws://192.168.99.100:32164