pega88 / chainlink-gcp Goto Github PK
View Code? Open in Web Editor NEWHosting a Chainlink node on Kubernetes using Terraform
Hosting a Chainlink node on Kubernetes using Terraform
Hi there,
When trying to create GKE cluster, I see the following log at the end:
google_container_cluster.gke-cluster: Creation complete after 6m10s [id=projects/***/locations/europe-west1-b/clusters/chainlink]
However, I observe the cluster nodes being automatically deleted after seemingly successful creation.
The final result is like this:
after thay I got
│ Error: namespaces "chainlink" not found
│
│ with kubernetes_secret.password-credentials,
│ on chainlink-node.tf line 85, in resource "kubernetes_secret" "password-credentials":
│ 85: resource "kubernetes_secret" "password-credentials" {
│
╵
╷
│ Error: Failed to create deployment: namespaces "chainlink" not found
│
│ with kubernetes_deployment.chainlink-node,
│ on chainlink-node.tf line 99, in resource "kubernetes_deployment" "chainlink-node":
│ 99: resource "kubernetes_deployment" "chainlink-node" {
│
I tried both master
and feature/tf-upgrade
versions.
Could it be IAM issue?
Thank you!
Hey Pega88.
I've already followed the instruction and all run well until the process got an error after
Updated IAM policy for the project [project-id]
it looks like it's needed to update the command line argument, you can see the error produced below:
Or it could be I've missed something?
Thanks, Pega88!
on chainlink-node.tf line 18, in provider "kubernetes":
18: token = "${data.google_client_config.default.access_token}"
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
(and 10 more similar warnings elsewhere)
Warning: Quoted type constraints are deprecated
on variables.tf line 3, in variable "project_name":
3: type = "string"
Terraform 0.11 and earlier required type constraints to be given in quotes,
but that form is now deprecated and will be removed in a future version of
Terraform. To silence this warning, remove the quotes around "string".
(and 5 more similar warnings `elsewhere)```
For those who come along, I ran into this issue after firing up the GKE environment and noticing my Pods were going through CrashLoopBackOff. I was getting a 502 from the targeted Eth Node in chainlink-node.tf
devadmin@ThunderCloud:/mnt/e/Development/chainlink-gcp$ kubectl logs pod/chainlink-75dd5b6bdf-8b7zc --tail 15
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations" WHERE (id = $1) [email protected]/gormigrate.go:389 rows_affected=0 time=0.002688183
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations" WHERE (id = $1) [email protected]/gormigrate.go:389 rows_affected=0 time=0.0018155
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations" WHERE (id = $1) [email protected]/gormigrate.go:389 rows_affected=0 time=0.000888291
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations" WHERE (id = $1) [email protected]/gormigrate.go:389 rows_affected=0 time=0.000422136
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations" WHERE (id = $1) [email protected]/gormigrate.go:389 rows_affected=0 time=0.000611819
2021-09-03T18:35:03Z [DEBUG] P2P_PEER_ID was not set, using the first available key chainlink/application.go:255 peerID=p2p_12D3KooWLpuf9HMEni3HUn45EA1YQLxMbFLPN8jQ2SNCpiYXLoKz
2021-09-03T18:35:03Z [DEBUG] Off-chain reporting disabled chainlink/application.go:186
2021-09-03T18:35:03Z [WARN] /chainlink/.password has overly permissive file permissions, reducing them from -rw-r--r-- to -rw------- cmd/local_client.go:168
2021-09-03T18:35:03Z [WARN] open /chainlink/.password: read-only file system cmd/local_client.go:60
2021-09-03T18:35:04Z [INFO] Unlocked account 0x9f08E5d2130714dd0dE0944a9C9deF7EFe77E638 store/key_store.go:76 address=0x9f08E5d2130714dd0dE0944a9C9deF7EFe77E638
2021-09-03T18:35:05Z [DEBUG] Unlocked P2P key offchainreporting/keystore.go:56 peerID=p2p_12D3KooWLpuf9HMEni3HUn45EA1YQLxMbFLPN8jQ2SNCpiYXLoKz
2021-09-03T18:35:06Z [DEBUG] Unlocked OCR key offchainreporting/keystore.go:63
2021-09-03T18:35:06Z [INFO] API exposed for user [email protected] cmd/local_client.go:98
2021-09-03T18:35:06Z [DEBUG] eth.Client#Dial(...) eth/client.go:127
error starting app: websocket: bad handshake (HTTP status 502 Bad Gateway)
Validated with wscat:
devadmin@ThunderCloud:/mnt/e/Development/chainlink-gcp$ wscat -c wss://ropsten-rpc.linkpool.io/ws
error: Unexpected server response: 502
Setup my own Eth Node on Infura and validated it connects properly:
> devadmin@ThunderCloud:/mnt/e/Development/chainlink-gcp$ wscat -c wss://ropsten.infura.io/ws/v3/a13a37a22d784e39926def7c35e9e415
Connected (press CTRL+C to quit)
Then I modified the chainlink-node.tf with my changes;
resource "kubernetes_config_map" "chainlink-env" {
metadata {
name = "chainlink-env"
namespace = "chainlink"
}
resource "kubernetes_config_map" "chainlink-env" {
metadata {
name = "chainlink-env"
namespace = "chainlink"
}
data = {
#"env" = file("config/.env")
ROOT = "/chainlink"
LOG_LEVEL = "debug"
ETH_CHAIN_ID = 3
MIN_OUTGOING_CONFIRMATIONS = 2
LINK_CONTRACT_ADDRESS = "0x20fe562d797a42dcb3399062ae9546cd06f63280"
CHAINLINK_TLS_PORT = 0
SECURE_COOKIES = false
GAS_UPDATER_ENABLED = true
ALLOW_ORIGINS = "*"
DATABASE_URL = format("postgresql://%s:%s@postgres:5432/chainlink?sslmode=disable",var.postgres_username,random_password.postgres-password.result)
DATABASE_TIMEOUT = 0
ETH_URL = "wss://ropsten.infura.io/ws/v3/a13a37a22d784e39926def7c35e9e415"
}
}
Hey Pega88 (Niels), thanks much for all the work you did on this deployment manifest. Awesome work! I ran into an issue with what I believe is a race condition with the chainlink namespace getting started on the K8 cluster. Did you run into this issue and if so, did you ever get a workaround?
google_container_cluster.gke-cluster: Creation complete after 5m27s [id=projects/chainlink-test-324713/locations/us-central1-c/clusters/chainlink-cluster]
kubernetes_namespace.chainlink: Creating...
kubernetes_secret.password-credentials: Creating...
kubernetes_service.chainlink_service: Creating...
kubernetes_config_map.chainlink-env: Creating...
kubernetes_secret.api-credentials: Creating...
kubernetes_config_map.postgres: Creating...
kubernetes_service.postgres: Creating...
kubernetes_deployment.chainlink-node: Creating...
kubernetes_stateful_set.postgres: Creating...
kubernetes_namespace.chainlink: Creation complete after 0s [id=chainlink]
╷
│ Error: namespaces "chainlink" not found
│
│ with kubernetes_config_map.chainlink-env,
│ on chainlink-node.tf line 28, in resource "kubernetes_config_map" "chainlink-env":
│ 28: resource "kubernetes_config_map" "chainlink-env" {
│
╵
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.