GCP/GKE K8S Guide to deploy and monitor a Chainlink Cluster
- GCP Account
- Project Created
- PostgreSQL DB Server created, with username and password and database name setup
- Websocket RPC Endpoint either cloud provider such as Infura, or self hosted (ie: ip:8546)
- On your local client: Google SDK installed
- Google SDK has Kubectl installed
gcloud auth login
gcloud config set project kubernetes-chainlink
gcloud beta container --project "kubernetes-chainlink" clusters create "cluster-1" --zone "us-central1-c" --no-enable-basic-auth --cluster-version "1.22.8-gke.202" --release-channel "regular" --machine-type "e2-custom-4-8192" --image-type "COS_CONTAINERD" --disk-type "pd-ssd" --disk-size "10" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --max-pods-per-node "110" --num-nodes "1" --logging=SYSTEM,WORKLOAD --monitoring=SYSTEM --enable-ip-alias --network "projects/kubernetes-bf-chainlink/global/networks/default" --subnetwork "projects/kubernetes-bf-chainlink/regions/us-central1/subnetworks/default" --no-enable-intra-node-visibility --default-max-pods-per-node "110" --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing,GcePersistentDiskCsiDriver --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0 --enable-shielded-nodes --tags "chainlink-node" --node-locations "us-central1-c"
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
cluster-1 us-central1-c 1.22.8-gke.202 35.225.229.3 e2-custom-4-8192 1.22.8-gke.202 1 RUNNING
gcloud container clusters get-credentials cluster-1 --zone us-central1-c --project kubernetes-chainlink
kubectl create namespace chainlink
kubectl get namespaces --show-labels
kubectl config set-context --current --namespace=chainlink
Upload .api
which contains the email+password to access the GUI, and .password
which contains the keystore password:
kubectl create secret generic api-env --from-file=".api"
kubectl create secret generic password-env --from-file=".password"
openssl req -x509 -out ~/server.crt -keyout ~/server.key \
-newkey rsa:2048 -nodes -sha256 -days 365 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
kubectl create secret generic crt-env --from-file="server.crt"
kubectl create secret generic key-env --from-file="server.key"
kubectl get secret --namespace chainlink
kubectl apply -f "rpc-failover-deploy.yaml"
kubectl apply -f "node-env.yaml"
kubectl apply -f "deploy.yaml"
kubectl get pod -n chainlink
NAME READY STATUS RESTARTS AGE
chainlink-7c77f9cf-5xqvh 1/1 Running 0 74s
rpc-failover-7b78bfb988-xwt6t 1/1 Running 0 80s
kubectl logs chainlink-7c77f9cf-5xqvh
kubectl port-forward service/chainlink 6689
<your gui email>
<your gui password>