Skip to content

This simple app allows you to retreive an Ethereum addres balance; it is made to showcase how to deploy such apps on Kubernetes

License

Notifications You must be signed in to change notification settings

chainstacklabs/get-started-with-kubernetes

Repository files navigation

Labs

Chainstack is the leading suite of services connecting developers with Web3 infrastructure

         

HomepageSupported protocolsChainstack blogChainstack docsBlockchain API reference
Start for free

Getting Started with Kubernetes

Deploy an Express.js Server with a Load Balancer

This repository contains all the necessary scripts and code to deploy an Express.js server on a Kubernetes cluster hosted on Linode.

The app uses the Express framework to create a simple API server that interacts with the Ethereum blockchain. It utilizes the Web3.js library to fetch the balance of an Ethereum address using a Chainstack node.

The project aims to provide a comprehensive guide for beginners to get hands-on experience with Kubernetes deployments, pod management, and load balancing.

Find the full guide on Chainstack's Developer Portal: Getting started with Kubernetes on Linode

Prerequisites

Quick Start

  1. Clone the Repository

    git clone https://github.com/soos3d/get-started-with-kubernetes.git
    
  2. Navigate to the Project Directory

    cd get-started-with-kubernetes
    
  3. Set KUBECONFIG Environment Variable

    Deploy a kubernetes cluster on Linode and get the kubeconfig.yaml file, then add it to the project and run:

    export KUBECONFIG=kubeconfig.yaml
    
  4. Deploy the Pod

    First deploy an Ethereum node on Chainstack:

    1. Sign up with Chainstack.
    2. Deploy a node.
    3. View node access and credentials.

    Use the node RPC URL as environment variable.

    kubectl run addressbalance --image=soos3d/addressbalance:latest --port=80 --env="ETHEREUM_RPC_URL=YOUR_CHAINSTACK_NODE_URL" --env="PORT=3333"
    

    This will deply one pod manually.

  5. Deploy Using Manifest

    Find the manifest in the k8s directory.

    Add the Chainstack RPC node to the environment variables.

    env:
      - name: ETHEREUM_RPC_URL
        value: "YOUR_CHAINSTACK_RPC_URL"
      - name: PORT
        value: "3333"

    Then run:

    kubectl apply -f server_deployment.yaml

    This will deploy 4 managed pods.

  6. Set Up Load Balancer

    Find the manifest in the k8s directory.

    kubectl apply -f server_loadbalance.yaml
    

Features

  • Step-by-step guide to deploying your first pod
  • Detailed explanation of Kubernetes Deployment manifests
  • Load balancing with Linode's built-in service
  • Environment variable configuration

Contributing

Feel free to open issues or PRs if you find any problems or have suggestions for improvements.

About

This simple app allows you to retreive an Ethereum addres balance; it is made to showcase how to deploy such apps on Kubernetes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published