Links

Deploy Chainlink Node

Prerequisites

Ethereum Node

Chainlink node requires access to an EVM chain node with WebSocket server enabled. Here's how to deploy a simple Ethereum Rinkeby node with WebSocket server enabled:
apiVersion: ethereum.kotal.io/v1alpha1
kind: Node
metadata:
name: besu-rinkeby-node
spec:
network: rinkeby
client: besu
ws: true
After deploying this node, it can be accessed in-cluster using ws://besu-rinkeby-node:8546 🔥. Read Ethereum guide for more details on how to deploy public and private network nodes.

PostgreSQL Database

Chainlink requires access to PostgreSQL database instance.
You can use a hosted database a service to obtain PostgreSQL database:
You can also deploy your own PostgreSQL database instance from official PostgreSQL docker image.

Keystore and API Password

Chainlink node requires a strong password for securing access to keystore (wallet) and API. We will store this password in Kubernetes secret my-password:
apiVersion: v1
kind: Secret
metadata:
name: my-password
stringData:
password: fE2xXKDnR3ns489X

TLS Certificate

Chainlink optionally requires TLS certificate to secure access to the node API. Using cert-manager we can issue a simple self-signed certificate and store it in a Kubernetes secret:
# create self-signed certificate issuer
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: self-signed-issuer
spec:
selfSigned: {}
---
# create certificate for chainlink node
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: chainlink-node-cert
spec:
dnsNames:
- "chainlink-node.svc"
- "chainlink-node.svc.cluster.local"
# store tls.crt and tls.key in this kubernetes secret
secretName: chainlink-node-cert
issuerRef:
name: self-signed-issuer
With access to Ethereum Rinkeby node, PostgreSQL database, tls certificate and a strong password. We're ready to deploy our Chainlink node to create jobs and satisfy requests:
chainlink.yaml
apiVersion: chainlink.kotal.io/v1alpha1
kind: Node
metadata:
name: chainlink-node
spec:
ethereumChainId: 4
ethereumWsEndpoint: "ws://besu-rinkeby-node:8546"
linkContractAddress: "0x01BE23585060835E02B77ef475b0Cc51aA1e0709"
databaseURL: "postgresql://username:[email protected]:port/name"
keystorePasswordSecretName: "my-password"
certSecretName: "chainlink-node-cert"
apiCredentials:
passwordSecretName: "my-password"
In this manifest, we're describing Chainlink node that connects to Ethereum Rinkeby node using ethereumWsEndpoint, setting ethereum chain ID using ethereumChainId, setting link contract address using linkContractAddress, connecting to postgress database instance using databaseURL, setting wallet password using keystorePasswordSecretName which accepts a name of k8s secret, setting tls configuration using certSecretName which accepts k8s secret name that holds tls.key and tls.crt, and finally setting API credentials using apiCredentials.
Apply chainlink.yaml manifest:
kubectl apply -f chainlink.yaml
Kotal operator will notice your chainlink-node and will create all the necessary pods, persistent volumes, services, configmaps, and secrets neccessary.
You can fetch the deployed Chainlink Node using:
kubectl get nodes.chainlink
It will return an output similar to the following:
NAME CLIENT EthereumChainId
chainlink-node chainlink 4
If you added -o wide it will return more info like link contract address
NAME CLIENT EthereumChainId LinkContractAddress
chainlink-node chainlink 4 0x01BE23585060835E02B77ef475b0Cc51aA1e0709

Fetch Node Logs

Get the pods that has been created by Kotal for the node:
kubectl get pods
It will return an output similar to the following:
NAME READY STATUS RESTARTS AGE
chainlink-node-0 1/1 Running 0 1m
Get the logs of the running node:
kubectl logs -f chainlink-node-0
Chainlink node comes with a user interface for managing the node, and it's being served by default on port 6688.
Forward localhost:6688 calls to the node pod:
kubectl port-forward chainlink-node-0 6688
Open https://localhost:6688 and it will take you to Chainlink node UI. It will ask you for API credentials. Enter the email address in your node's .spec.apiCredentials.email, and in the password field, enter fE2xXKDnR3ns489X.
🔥🔥🔥
Finally you can delete the node by:
kubectl delete -f chainlink.yaml
​
node.chainlink.kotal.io "chainlink-node" deleted
Kubernetes garbage collector will delete all the resources that has been created by Kotal Chainlink Node controller.