Running Gridcoin on Kubernetes
Motivation
Gridcoin nodes with focus on high availability are deployed on Kubernetes cluster.
Kubernetes
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
Persistent Volumes
Managing storage is a distinct problem from managing compute instances. The PersistentVolume subsystem is used to store blockchain data.
$ kubectl apply -f gridcoin-volume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: gridcoin-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/gridcoin-pv-volume"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gridcoin-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Deployment
Deployment tells Kubernetes how to create or modify instances of the pods that hold a containerized application.
$ kubectl apply -f gridcoin-deployment.yaml
apiVersion: v1
kind: Service
metadata:
name: gridcoin
annotations:
service.beta.kubernetes.io/exoscale-loadbalancer-id: "21exf891-2750-49a5-mpl8-e3f360e1xa50"
service.beta.kubernetes.io/exoscale-loadbalancer-external: "true"
spec:
ports:
- port: 32749
protocol: TCP
targetPort: 32749
selector:
app: gridcoin
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gridcoin
spec:
selector:
matchLabels:
app: gridcoin
strategy:
type: Recreate
template:
metadata:
labels:
app: gridcoin
spec:
containers:
- image: osgiliath/gridcoin:oracle9
name: gridcoin
env:
- name: GRIDCOIN_RPC_USER
value: grcuser
- name: GRIDCOIN_RPC_PASS
value: grcpass
- name: GRIDCOIN_EXT_IP
value: at.gridcoin.pl
- name: GRIDCOIN_DATA_DIR
value: /mnt/gridcoin
ports:
- containerPort: 32749
name: gridcoin
volumeMounts:
- name: gridcoin-persistent-storage
mountPath: /mnt
volumes:
- name: gridcoin-persistent-storage
persistentVolumeClaim:
claimName: gridcoin-pv-claim