An as-flexible-as-it can-be deployment system for the DLT infrastructure on Kubernetes.
Can probably be used in any kubernetes runtime with minimal configuration. For now, the only expectations are:
- A kubernetes cluster running somewhere locally or on the cloud.
- A Container Networking Interface (CNI), with or without support for NetworkPolicies. (This should be bundled with your kubernetes runtime, unless you go for bare metal)
- A KV database (any will do, most K8s installations come with etcd installed).
- A DNS and service discovery service (K8s usually comes bundled with CoreDNS out of the box, or easy very easy to enable).
The rest (Ingress, Storage, Certificates management) will be installed in the cluster creation process.
To deploy the network, the kafka configuration is needed for the consumers. To create it:
- Install
openjdk-8-jre-headless
or similar (keytool
is needed) andopenssl
. - Run
scripts/JKS2PEM.sh
. For example run:./scripts/JKS2PEM.sh ./kafka-config/kafka.client.truststore.jks ./kafka-config/server.cer.pem
- Copy all kafka configuration files to
config/kafka
. - Copy
docker_credentials.json.example
todocker_credentials.json
and change the credentials so that you can push on the registry of your choice. - If using a private registry with a self-signed certificate, you will need to add the certificate to the authorized certificates of the node. This can be done when running the
cluster
command with--self-signed-registry
. You will have to put your certificate inconfig/docker
with nameca.crt
.
RUNTIME marks your K8s runtime.
Important enviromental variables:
NO_VOLUMES (0 or 1): Controlls wether there are volumes used or emptyDir
SLA_CHANNEL_NAME: Name of SLA channel
VRU_CHANNEL_NAME: Name of VRU channel
PARTS_CHANNEL_NAME: Name of parts channel
SLA2_CHANNEL_NAME: Name of SLA 2.0 channel
SLA_CHAINCODE_NAME: SLA chaincode name
VRU_CHAINCODE_NAME: VRU chaincode name
PARTS_CHAINCODE_NAME: Parts chaincode name
SLA_CC_SRC_PATH: SLA chaincode path
VRU_CC_SRC_PATH: VRU chaincode path
PARTS_CC_SRC_PATH: Parts chaincode path
PLEDGER_NETWORK_CONTAINER_REGISTRY_HOSTNAME: Container registry hostname
PLEDGER_NETWORK_CONTAINER_REGISTRY_PORT: Container registry port
fabric-k8s.sh
arguments:
--no-volumes
: Disable volume mounting and uses emptyDirs. (EXPERIMENTAL: DOES NOT WORK)--skip-sla1
: Disable the creation of SLAv1 channel, chaincode and client. (EXPERIMENTAL: MIGHT BE BUGGY)--skip-sla2
: Disable the creation of SLAv2 channel and client. (EXPERIMENTAL: MIGHT BE BUGGY)--registry
: Explained below.--no-push
: Explained below.--random-tag
: Use random tags when pushing images. (Avoid some weird issue with image versions on microk8s)
- Run
./fabric-k8s.sh RUNTIME build [--registry REGISTRY] [--no-push]
This will build with a specific optional registry and push all the container images. - Login to the container registry by running
./fabric-k8s.sh login
. This needs to happen now, because namespace to have been created. - Run
./fabric-k8s.sh RUNTIME init
. Creates the KIND cluster, sets up ingress and cert-manager - Run
./fabric-k8s.sh RUNTIME up
. Brings up the CAs, orderers and peers. - Run
./fabric-k8s.sh RUNTIME channels
. Brings up the channels. - Run
./fabric-k8s.sh RUNTIME chaincodes
. Brings up the channels. - Run
./fabric-k8s.sh RUNTIME applications
. Deploys chaincodes and clients.
Run ./fabric-k8s.sh RUNTIME down
Run ./fabric-k8s.sh unkind
Override the corresponding variables from network-k8s.sh
with the proper ones.