HYPERLEDGER FABRIC via Kubernetes

First things first:

curl -sS https://starship.rs/install.sh | sh # get a starship
eval "$(starship init zsh)" # get on board
mkdir -p workspace/ideal
git init .
git config  user.email "[email protected]"
git config  user.name "LarsenClose"
ls
vim setup_hyperledger_fabric.sh
#!/bin/bash

set -e

# Function to check and install kubectl
install_kubectl() {
    if ! command -v kubectl &> /dev/null; then
        echo "kubectl not found. Installing it now."
        curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
        chmod +x ./kubectl
        sudo mv ./kubectl /usr/local/bin/kubectl
    fi
    kubectl version --client
}

# Function to check and install helm
install_helm() {
    if ! command -v helm &> /dev/null; then
        echo "helm not found. Installing it now."
        curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
    fi
    helm version
}

# Function to install Python3 and create virtual environment
install_python_venv() {
    sudo apt-get update
    sudo apt-get install -y python3 python3-venv python3-pip
    python3 -m venv hyperledger_venv
}

# Function to check and install ansible within venv
install_ansible() {
    . hyperledger_venv/bin/activate
    pip install --upgrade pip
    pip install ansible
    pip install kubernetes
    ansible --version
}

# Start Minikube
start_minikube() {
    minikube start --driver=docker
    kubectl config use-context minikube
}

# Create Kubernetes namespace
create_namespace() {
    kubectl create namespace oss-hlf-infra
}

# Clone the Hyperledger Fabric Ansible playbooks repository
clone_ansible_fabric() {
    if [ ! -d "fabric-ansible-collection" ]; then
        git clone https://github.com/hyperledger-labs/fabric-ansible-collection.git
    fi
    cd fabric-ansible-collection
}

# Build and install the Ansible collection from source
install_ansible_collection() {
    . ../hyperledger_venv/bin/activate
    ansible-galaxy collection build
    ansible-galaxy collection install hyperledger-fabric_ansible_collection-*.tar.gz
}

# Create Kubernetes secret for TLS
create_tls_secret() {
    mkdir -p tls
    openssl req -x509 -newkey rsa:4096 -keyout tls/tls.key -out tls/tls.crt -days 365 -nodes -subj "/CN=myfabric.local"
    kubectl create secret tls myfabric-tls-secret --cert=tls/tls.crt --key=tls/tls.key -n oss-hlf-infra
}

# Create Ansible inventory file
create_inventory_file() {
    cat <<EOF > inventory.ini
[all]
localhost ansible_connection=local

[k8s-cluster]
localhost

[hyperledger_fabric]
localhost
EOF
}

# Create Ansible playbook file
create_playbook_file() {
    cat <<EOF > install-oss.yml
---
- name: Deploy Hyperledger Fabric Open Source Operator and Custom Resource Definitions
  hosts: localhost
  vars:
    state: present
    target: k8s
    arch: amd64
    namespace: oss-hlf-infra
    wait_timeout: 3600
  roles:
    - hyperledger.fabric_ansible_collection.fabric_operator_crds

- name: Deploy Hyperledger Fabric Open Source Console
  hosts: localhost
  vars:
    state: present
    target: k8s
    arch: amd64
    namespace: oss-hlf-infra
    console_name: myfabric-console
    console_domain: myfabric.local
    console_email: [email protected]
    console_default_password: adminpw
    console_storage_class: standard
    console_tls_secret: myfabric-tls-secret
    wait_timeout: 3600
  roles:
    - hyperledger.fabric_ansible_collection.fabric_console
EOF
}

# Run the Ansible playbook to provision Hyperledger Fabric
run_ansible_playbook() {
    . ../hyperledger_venv/bin/activate
    ansible-playbook -i inventory.ini install-oss.yml -vvv
}

# Main function to orchestrate the setup
main() {
    install_kubectl
    install_helm
    install_python_venv
    . hyperledger_venv/bin/activate
    install_ansible
    start_minikube
    create_namespace
    create_tls_secret
    clone_ansible_fabric
    install_ansible_collection
    create_inventory_file
    create_playbook_file
    run_ansible_playbook

    # Check the status of the pods
    echo "Checking the status of the pods in the namespace oss-hlf-infra..."
    kubectl get pods -n oss-hlf-infra

    echo "If there are any issues, you can check the logs of the individual pods using:"
    echo "kubectl logs <pod-name> -n oss-hlf-infra"
}

# Execute the main function
main


next:

Multi-tenant cluster-api platform agnostic production ready high-availability

Hypë☈[Ku]bernetes

Relying upon the illusion of totally deterministic hardware and the subsequent locally optimal software design does not persist at scale.

5D hypercube here thanks to a lineage of a James after a Paul who was before a Peter following Oliver [most recently from the 5dstm, 5-dimensional Space-Time-Matter Consortium].

When engaging computational systems at scale these issues are undeniably common knowledge. So we have google to thank for open sourcing their Kubernetes project, circa 2015.

Enter Kubernetes:

(Picture one)Kubernetes Tribute here created with mini/dall-e model from huggingface[…]

Since being able to access the full dall-E model an update was in order with some enhanced remixes.

Kubernetes, a container orchestration system for automating software deployment, scaling, and management. Kubernetes delivers a more resilient and robust architecture.

This has allowed for the scaling of systems to:

While being administered and managed through interfaces like:

The cluster architecture is able to accomplish some more complex behaviors like self healing and some self organization.

Lens has a nice visualization extension which gives a visual rendering of the pods and their direct networked connections with one another in a 2d slice. This is a compilation of recording from a few other clusters, some much larger than this 10 rpi 4b shown in the other tools examples.

[Ku]bernetes tools

Lens also has decent ui/ux for administering and monitoring clusters.

K9s

K9s is a cli-console based program for management and administration

kubenav

Arguably the smoothest administrator interface experience is with Kubenav from your cellphone or desktop.


Longhorn: distributed block storage

Longhorn allows for basically single command setup of dynamically sized distributed block storage for k8s.

To flesh out this topic area going to split into a couple more posts, to be cont. […]

Nzt’s NFT’s – Art Collab with Dall-E

Recently granted access to Dall-E, OpenAI’s new generative Art AI, some of the collaborative works turned out alright. Here’s a few minted as NFT’s on the Solana Block chain.

The textual accompaniments are a mix of imagination, intuitive feel and very interesting results from prompts to a large gpt2 generative text AI model.

Linking to SolSea.io allows clicking the bottom right hand corner of the preview where the small outline of a square appears. Else nearly every method its only possible to see previews.