nats-io / terraform-provider-jetstream

Terraform Provider to manage NATS JetStream
Apache License 2.0
55 stars 13 forks source link

Terraform-provider-jetstream deploying on AKS ( Azure Kubernetes Service) #48

Closed bobbybhaskar closed 2 years ago

bobbybhaskar commented 2 years ago

Hello All, i am total new for "terraform-provider-jetstream" Here, There is an issue I am facing, while deploying Jetstream Provider or NATS deployment by using the Terraform on AKS ( Azure Kubernetes Service).

image

│ Error: context deadline exceeded │ │ with jetstream_stream.ORDERS, │ on nats.tf line 1, in resource "jetstream_stream" "ORDERS": │ 1: resource "jetstream_stream" "ORDERS" {

│ Error: nats: no responders available for request │ │ with jetstream_kv_bucket.stream, │ on nats.tf line 15, in resource "jetstream_kv_bucket" "stream": │ 15: resource "jetstream_kv_bucket" "stream" {

There are couple of doubles where I am confuses & stuck:

  1. When i try to deploy Jetstream Provide with terraform script on AKS ( Azure Kubernetes Service), Do i need provide a server or instances where NATS & nats-streaming is installed in that server, then assign the IP address in the "terraform provider".
  2. Where my azure instances I have installed nats-streaming. image

Here my terraform script:

proiver.tf

terraform {
  required_providers {
    jetstream = {
      source = "nats-io/jetstream"
      version = "0.0.28"
    }
  }
}

provider "azurerm" {
  features { }
}
provider "jetstream" {
  servers     = "myip:4222"
  #credential_data = var.ngs_credential_data
}

Nats.tf

resource "jetstream_stream" "ORDERS" {
  name     = "ORDERS"
  subjects = ["ORDERS.*"]
  storage  = "file"
  max_age  = 60 * 60 * 24 * 365
}
resource "jetstream_consumer" "ORDERS_NEW" {
  stream_id      = jetstream_stream.ORDERS.id
  durable_name   = "NEW"
  deliver_all    = true
  filter_subject = "ORDERS.received"
  sample_freq    = 100
}

resource "jetstream_kv_bucket" "stream" {
  name = "TEST"
  ttl = 60
  history = 10
  max_value_size = 1024
  max_bucket_size = 10240
}
ripienaar commented 2 years ago

If you do deployment to k8s you should use the k8s CRD resources not terraform ones I guess.

And the reason that's happening is probably because the logs you showed is from NATS Streaming Server, not NATS JetStream.

You should follow https://github.com/nats-io/k8s/tree/main/helm/charts/nats#jetstream to set up JetStream

bobbybhaskar commented 2 years ago

Hi @ripienaar Thanks for reply,

- Step1: Do I need to install the NATS JetStream in Azure instances ( Centos 7) is this link https://github.com/nats-io/k8s/tree/main/helm/charts/nats#jetstream should i follow installing "NATS JetStream" or Please can you provide me the link of How to install NATS JetStream in linux server(centos). -Step 2: You means terraform-provider-jetstream will not work for deploying with terraform script on AKS ( Azure Kubernetes Service), please provide me the link ( how to install or deploy the NATS on AKS with terraform ).

ripienaar commented 2 years ago

The link I already posted answers both questions.

ripienaar commented 2 years ago

See also https://docs.nats.io/running-a-nats-service/introduction/installation for more general help with installation

bobbybhaskar commented 2 years ago

Hi @ripienaar FYI I have installed the JetStream and NAT server in (centos VM): image

I am able to connect the port 4222 is working: image

But try to the script, It showing new error Called "Error: context deadline exceeded" image