- Akash Network to connect to.
- Established account address with some tokens(for gas) in network to create Provider registration.
- Kubernetes Cluster
- Akash Kubespray can help get a functional cluster bootstrapped.
- Provider Pod will require admin authorization.
Installed commands:
Create staging directory and cd into it
mkdir akash-demo && cd akash-demo
- Version:
1.19+
- A Kubernetes cluster with your local
kubectl
with admin authentication and authorization. - A wildcard A Record resolving to a cluster route-able IP. eg:
*.akashian.io
Option 1: Akash Kubespray
Akash has created an example Kubespray configuration to provision a Kubernetes installation on linux machines. Included are best practice configuration for CNI calico
plugin, default Network Policies + Namespaces, nginx
Ingress Controller, metrics-server
, cert-manager
, and Seccomp syscall restrictions.
Warning: needs to be updated
See here for seting up these prerequisites using GCE.
In this tutorial, we will be using the domain akashian.io
.
PROVIDER_DOMAIN=akashian.io
This PROVIDER_DOMAIN
variable is used to configure the Kubernetes Ingress Controller domain, so for this example, a Deployment's requests will be routed via a random subdomain, eg: kswtibraxfdhlflhrg6ahe.akashian.io
. A wildcard subdomain DNS entry is necessary to support this, eg *.akashian.io
. This address can be customized in the Configure provider services file's ingress-domain
field, eg: ingress-domain=ingress.akashian.io
.
We'll be connecting to the testnet.
export AKASH_NODE=tcp://rpc-edgenet.akashdev.net:26657
export AKASH_CHAIN_ID=edgenet
export AKASH_KEYRING_BACKEND=test
export AKASH_PROVIDER_KEY=provider
curl -sSfL https://raw.githubusercontent.com/ovrclk/akash/master/godownloader.sh | sh
export AKASH_HOME="$PWD/home"
mkdir -p "$AKASH_HOME"
akash keys add $AKASH_PROVIDER_KEY --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND
curl -s -o kustomization.yaml \
https://raw.githubusercontent.com/ovrclk/akash/master/_docs/examples/provider/kustomization.yaml
cat <<EOF > provider.yaml
host: http://provider.$PROVIDER_DOMAIN
attributes:
- key: region
value: us-west-demo-$(whoami)
EOF
View your address with
akash keys show provider -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND
You can fund the address at the testnet faucet.
Ensure you have funds with:
akash query bank balances --home=$AKASH_HOME --node=$AKASH_NODE "$(akash keys show $AKASH_PROVIDER_KEY -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND )"
Register your provider on the Akash Network:
Replace --from
flag value with your own
akash tx provider create provider.yaml --from $AKASH_PROVIDER_KEY --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND --node=$AKASH_NODE --chain-id=$AKASH_CHAIN_ID
cat <<EOF > client-config.txt
node=$AKASH_NODE
chain-id=$AKASH_CHAIN_ID
EOF
cat <<EOF > provider-config.txt
ingress-static-hosts=true
ingress-domain=$PROVIDER_DOMAIN
EOF
This will configure the kubernetes ingress to point to your provider.
cat <<EOF > gateway-host.yaml
- op: replace
path: /spec/rules/0/host
value: provider.$PROVIDER_DOMAIN
EOF
Replace "password" below with your own unique secret.
echo "password" > key-pass.txt
(cat key-pass.txt; cat key-pass.txt) | akash --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND keys export $AKASH_PROVIDER_KEY 2> key.txt
Create the akash-services
namespace for running Provider.
kubectl apply -f https://raw.githubusercontent.com/ovrclk/akash/master/_docs/kustomize/networking/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/ovrclk/akash/master/pkg/apis/akash.network/v1/crd.yaml
kubectl kustomize .
kubectl kustomize . | kubectl apply -f-
akash provider status --node=$AKASH_NODE --provider "$(akash keys show $AKASH_PROVIDER_KEY -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND)"
akash keys add deploy --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND
View your address with
akash keys show deploy -a --home=$AKASH_HOME --keyring-backend$AKASH_KEYRING_BACKEND
You can fund the address at the testnet faucet.
Ensure you have funds with:
akash query account --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND --node=$AKASH_NODE "$(akash keys show deploy -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND )"
curl -s -o deployment.yaml \
https://raw.githubusercontent.com/ovrclk/akash/master/_docs/examples/provider/deployment.yaml
sed -i.bak "s/us-west/us-west-demo-$(whoami)/g" deployment.yaml
akash --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND --chain-id=$AKASH_CHAIN_ID --node=$AKASH_NODE --from deploy tx deployment create ./deployment.yaml
akash query market order list --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND --owner "$(akash keys show deploy -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND)"
akash query market bid list --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND --owner "$(akash keys show deploy -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND)"
akash query market lease list --node=$AKASH_NODE --owner "$(akash keys show deploy -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND)"
note: This can be set when creating the deployment. It defaults to the block height at that time.
DSEQ="$(akash query market lease list --node=$AKASH_NODE --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND \
--owner "$(akash keys show deploy -a --home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND )" \
| jq -r '.[0].id.dseq')"
akash provider send-manifest deployment.yaml --node=$AKASH_NODE \
--home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND \
--dseq "$DSEQ" \
--oseq 1 \
--gseq 1 \
--owner "$(akash keys show deploy -a)" \
--provider "$(akash keys show provider -a)"
akash provider lease-status --node=$AKASH_NODE \
--home=$AKASH_HOME --keyring-backend=$AKASH_KEYRING_BACKEND \
--dseq "$DSEQ" \
--oseq 1 \
--gseq 1 \
--owner "$(akash keys show deploy -a)" \
--provider "$(akash keys show provider -a)"
akash provider lease-status \
--dseq "$DSEQ" \
--oseq 1 \
--gseq 1 \
--owner "$(akash keys show deploy -a)" \
--provider "$(akash keys show provider -a)" | \
jq -r '.services[0].uris[0]' | \
while read -r line; do
open "http://$line"
done
akash tx deployment close \
--node=$AKASH_NODE \
--chain-id=$AKASH_CHAIN_ID \
--home=$AKASH_HOME \
--keyring-backend=$AKASH_KEYRING_BACKEND \
--from $OWNER_ADDRESS \
--dseq $DSEQ