You'll need a few things:
- corda cli
- cordapp builder
- java 11
- docker desktop or another kubernetes cluster running tool (minukube, etc.)
brew install docker kubectl helm
Make sure to set docker for mac's resources for this demo. Ideally 8GB CPU, and 12GB of Memory.
We'll start by adding the kubernetes dashboard to our cluster so we can actually see these apps
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
# deploy kubernetes dashboard
helm install dashboard kubernetes-dashboard/kubernetes-dashboard -n kubernetes-dashboard --create-namespace
# to proxy traffic to kubernetes cluster and the local browser, run this in a separate terminal:
kubectl proxy
# visit the kubernetes dashboard
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:dashboard-kubernetes-dashboard:https/proxy/#/login
# download a kubernetes admin user config file
# I've written an example one here
wget https://gist.githubusercontent.com/davidawad/48f7873d843e966cb81f7f6cb4df5466/raw/d7094df6d7c7c65bcb50534025482121bf619a0d/service-account.yaml
# apply the config file to create an admin-user account in our kubernetes cluster
kubectl apply -f service-account.yaml
# get the token for our dashboard
kubectl describe serviceaccount admin-user -n kubernetes-dashboard
You'll see output like this:
Name: admin-user
Namespace: kubernetes-dashboard
Labels: <none>
Annotations: <none>
Image pull secrets: <none>
Mountable secrets: admin-user-token-bvthf
Tokens: admin-user-token-bvthf # <-- this one
Events: <none>
# Get the string for the token and inject it into this command like so:
kubectl describe secret admin-user-token-bvthf -n kubernetes-dashboard
You'll get output like this:
Data
====
ca.crt: 1066 bytes
namespace: 20 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IkJ3X2lwc25SV21rREh2NnFiS1NPZDhUd2ZsZldiR0RrRFZjcEZydXlZVlEifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLWJ2dGhmIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI0M2RhZWNhNC05YTBiLTQ5NjYtODhiMy04NDgyM2JmYzA3ZmEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4tdXNlciJ9.LWB1POuxpIRR-6CkJJAgiZsQ-dceHbgCBlzt120StcVdTANnEYoPjjyjRx-y_HGz4FGq2tZisp7NPSlQr6ie2eVAqljZVUztiOC_ISnVwKL6sAS12-6FRdvTMmI8EJyPgF4LTnH9EZtA98inYPA7Cdm4_rFuBzPFdzeuAvKfUAsxKWKWmdGJEIEaYQUcY31_WybGPBT-HObDnro9mQ2c0tKXO-QYl_X32zTz1ke5WO5cWYX4Vt7BbuKcYYRV3ymLfbJUQSoLZmqlX-MmmvxmbOGQvnpYehJ-fQMxrtWMITw59O2z461oOmZipg9sv8cs59ZsCWQOwlO8pBK2lHKA3w
# That Massive token is your token to login to the dashboard!
Now we have a couple of commands to run here
./gradlew clean build
cordapp-builder create --cpk contracts/build/libs/corda5-template-contracts-1.0-SNAPSHOT-cordapp.cpk --cpk workflows/build/libs/corda5-template-workflows-1.0-SNAPSHOT-cordapp.cpk -o template.cpb
corda-cli network config kubernetes template-network
corda-cli network deploy -n template-network -f c5cordapp-template.yaml -t 5.0.0-devpreview-rc07 > corda-k8s-network.yaml
Now we can apply the kubernetes config file to our network
kubectl apply -f corda-k8s-network.yaml
You can examine the network on your machine by once again using corda-cli
corda-cli network status -n template-network