OpenG2P In a Box

Getting started with OpenG2P

This document describes a deployment model wherein the infrastructure and components required by OpenG2P modules can be set up on a single node/VM/machine. This will help you to get started with OpenG2P and experience the functionality without having to meet all resource requirements for a production-grade setup. This is based on V4 architecture, but a compact version of the same. The essence of the V4 is preserved so that upgrading the infra is easier when more hardware resources are available.

Deployment architecture

Do NOT use this deployment model for production/pilots.



  • Machine with the following configuration

    • 16 vCPU/64GB RAM/256 GB storage

    • OS: Ubuntu 22.04

Base infrastructure setup

To set up the base infrastructure, login to the machine and install the following:

  1. Set up Firewall. Make sure to include K8s Firewall, NFS Firewall, Wireguard Firewall, and LB Firewall, all in the same machine.

  2. Install Wireguard Bastion servers:

    • Run this command for each wireguard server/channel:

      WG_MODE=k8s ./ <name for this wireguard server> <client ips subnet mask> <port> <no of peers> <subnet mask of the cluster nodes & lbs>
    • For example:

      WG_MODE=k8s ./ wireguard_app_users 51820 254
      WG_MODE=k8s ./ wireguard_sys_admins 51821 254
    • Check logs of the servers and wait for all servers to finish startup. Example:

      kubectl -n wireguard-system logs -f wireguard-sys-admins
  3. Install NFS Server.

  4. Istio: Setup; from kubernetes/istio directory, run the following:

    istioctl operator init
    kubectl apply -f istio-operator-no-external-lb.yaml
    kubectl apply -f istio-ef-spdy-upgrade.yaml
  5. Set up TLS using the following:

    • Create SSL Certificate using Letsencrypt for Rancher (Edit hostname below):

      certbot certonly --agree-tos --manual \
          --preferred-challenges=dns \
    • Create Rancher TLS Secret (Edit certificate paths below):

      kubectl -n istio-system create secret tls tls-rancher-ingress \
          --cert /etc/letsencrypt/live/ \
          --key /etc/letsencrypt/live/
    • Create SSL Certificate using Letsencrypt for Keycloak (Edit hostname below):

      certbot certonly --agree-tos --manual \
          --preferred-challenges=dns \
    • Create Keycloak TLS Secret, using (Edit certificate paths below):

      kubectl -n istio-system create secret tls tls-keycloak-ingress \
          --cert /etc/letsencrypt/live/ \
          --key /etc/letsencrypt/live/
  6. Set up DNS for Rancher and Keycloak hostnames to point to the IP of the node.

  7. Rancher Install; from kubernetes/rancher directory, run the following (Edit hostname below): \
    TLS=true \
        ./ --set replicas=1
    • Login to Rancher using the above hostname and bootstrap the admin user according to the instructions. After successfully logging in to Rancher as admin, save the new admin user password in local cluster, in cattle-system namespace, under rancher-secret, with key adminPassword.

  8. Keycloak Install; from kubernetes/keycloak directory, run the following (Edit hostname below): \
    TLS=true \
        ./ --set replicaCount=1
  9. Continue to use the same cluster (local cluster) for OpenG2P Modules also.

    • In Rancher, create a Project and Namespace, on which the OpenG2P modules will be installed. The rest of this guide will assume the Namespace to be dev .

    • In Rancher -> Namespaces menu, enable "Istio Auto Injection" for dev namespace.

  10. Follow Istio Namespace setup:

    1. Edit and run this to define the variables:

      export NS=dev
      export WILDCARD_HOSTNAME='*'
    2. Run this apply gateways

      kubectl create ns $NS
      envsubst < istio-gateway-tls.yaml | kubectl apply -f -
    3. Create SSL Certificate using Letsencrypt for the wildcard hostname used above. Example usage:

      certbot certonly --agree-tos --manual \
          --preferred-challenges=dns \
          -d \
          -d *
    4. Add the certificate to K8s.

      kubectl -n istio-system create secret tls tls-openg2p-$NS-ingress \
          --cert=<certificate path> \
          --key=<certificate key path>
  11. Install Prometheus and Monitoring from Rancher

  12. Install Logging and Fluentd. (TODO)

OpenG2P modules' installation

Install OpenG2P modules via Rancher.

How is "In a Box" different from V4? Why should this not be used for production?

  • In-a-box does not use the Nginx Load Balancer. The HTTPS traffic directly terminates on the Istio gateway via Wireguard. However, Nginx is required in production as described here.

  • The SSL certificates are loaded on the Istio gateway while in V4 the certificates are loaded on the Nginx server.

  • The Wireguard bastion runs inside the Kubernetes cluster itself as a pod. This is not recommended in production where Wireguard must run on a separate node.

  • A single private access channel is enabled (via Wireguard). In production, you will typically need several channels for access control.

  • In-a-box does not offer high availability as the node is a single point of failure.

  • NFS runs inside the box. In production, NFS must run on a separate node with its access control, allocated resources and backups.

Last updated


Copyright © 2024 OpenG2P. This work is licensed under Creative Commons Attribution International LicenseCC-BY-4.0 unless otherwise noted.