prysm-pulse/k8s
Preston Van Loon 26fec66da4
Kubernetes - Part 1 of ?? (#348)
* Add basic k8s configuration for geth deployments

* set genesis difficulty to 0x0

* gazelle, comments

* More comments on priority class and adjust priority class for ethstats

* Adjustments to the miner limits

* set minimum gas price to 0
2018-07-30 10:04:47 -04:00
..
geth Kubernetes - Part 1 of ?? (#348) 2018-07-30 10:04:47 -04:00
tools Kubernetes - Part 1 of ?? (#348) 2018-07-30 10:04:47 -04:00
BUILD.bazel Kubernetes - Part 1 of ?? (#348) 2018-07-30 10:04:47 -04:00
priority.yaml Kubernetes - Part 1 of ?? (#348) 2018-07-30 10:04:47 -04:00
README.md Kubernetes - Part 1 of ?? (#348) 2018-07-30 10:04:47 -04:00

Kubernetes

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

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

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. This seems iterate over 2 DAG epochs dispite the flags set for 1 DAG in memory and in disk.

Note: This can be improved by giving the miner more CPU.

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