Skip to content

Demos Iteration 9 K8S Localnet And Logging

user_name edited this page Feb 15, 2023 · 1 revision

Iteration 9 Demo: LocalNet k8s & Logging Infrastructure

tl;dr Run a LocalNet using k8s, monitor your cluster, develop on top of it, scale it and search logs in Grafana.

Table of Contents

Motivation

Demo Goals

  1. Deploy a V1 LocalNet using k8s
  2. Present infrastructure that can be used to deploy remote clusters
  3. Demonstrate tooling that can be used to scale a cluster
  4. Demo a mature logging framework integrated with Grafana

Why?

  1. Make it easier to deploy a DevNet and TestNet in the future
  2. Collect telemetry and gain visibility into node operations
  3. Enable stress/chaos testing in the future
  4. Provide tooling & infrastructure for both PNI and external node runners
  5. Streamline development & debugging

Demo Non-Goals

  1. Pocket-specific Utility
  2. Sending on-chain transactions

Demo

Pre-Requisites

  1. Basic env setup based on instructions at docs/development/README.md

  2. k8s Localnet env setup based on instructions at build/localnet/README.md

  3. [Optional] Learn about the logging library at logger/docs/README.md

Instruction

  1. Start up a k8s LocalNet and press Space when prompted
make localnet_up
  1. Confirm that the Validators are present and select the recommended UI at the top left; or visit http://localhost:10350/r/(all) directly

Tilt UI

  1. Open up the debug client and select TriggerNextView a few times when prompted to increase the chain height
make localnet_client_debug
  1. Use the Tilt UI to select a Validator and inspect its logs

Validator Logs

  1. Commit a few blocks via CLI

  2. Search for Line contains ”Committing block”

Committed Block

  1. Rather than viewing in Tilt, you can use Grafana to view & filter them as well. Go to http://localhost:42000 click on explore; or visit this link directly.

Grafana

  1. You can filter by label:

Grafana UI

  1. Or create more complex filter using by parsing {{.log}} as shown below:

Complex Filter

  1. To scale the number of validator, change count to 10 in ./localnet_config.yaml and visit the Tilt UI:

Validator 10

  1. Bonus: Verify that changing the code retriggers the cluster to rebuild the image: Hot-Reloading out of the box!

Next Steps

  1. Improved log parsing
  2. Automate validator staking when scaling
  3. Discover peers (nodes or actors) when connected to the network
  4. Sync new nodes to the latest height
Clone this wiki locally