Tyk unable to connect to Redis (ArgoCD)

Hi folks, first time poster here

I am attempting to do a first-time install of Tyk headless on an AKS cluster via Helm chart as described here. We are using ArgoCD for declaratively setting up our cluster, so helm install commands are replaced by ArgoCD helm apps.

After having followed the guide both Redis and Tyk seems to be set up and running correctly, but when attempting to hit the “/hello” endpoint, I get the following error:

{
  "status": "fail",
  "version": "5.0.0",
  "description": "Tyk GW",
  "details": {
    "redis": {
      "status": "fail",
      "output": "storage: Redis is either down or was not configured",
      "componentType": "datastore",
      "time": "2023-06-07T12:58:15Z"
    }
  }
}

The Tyk headless pod logs keep repeating the same error:

time="Jun 07 13:05:35" level=error msg="cannot set key in pollerCacheKey" error="storage: Redis is either down or was not configured"
time="Jun 07 13:05:35" level=error msg="Redis health check failed" error="storage: Redis is either down or was not configured" liveness-check=true prefix=main
time="Jun 07 13:05:35" level=error msg="Connection to Redis failed, reconnect in 10s" error="storage: Redis is either down or was not configured" prefix=pub-sub

I have retrieved the Redis password with the following command:

kubectl get secret --namespace tyk redis -o jsonpath="{.data.redis-password}"

And decrypted it with this command:

[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("[encoded password]"))

and added it to a redis.pass parameter in my ArgoCD app.

Similarly, I have set the redis.addrs to “redis-master:6379”, which is the name and port number of the redis master Service. Is this correct?

I have also tried to reinstall and restart both Tyk and Redis several times to ensure changes came through. I have ensured that Redis was fully up and running before starting Tyk.

What might be wrong here? Any help or feedback is much appreciated.

Cheers, Mike

I got it working. Here is the full ArgoCD Helm app for deploying Tyk headless with Redis, for future reference:

Redis app:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: redis-helm-app
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    chart: redis
    repoURL: 'https://charts.bitnami.com/bitnami'
    targetRevision: 17.11.3 
    helm:
      releaseName: redis
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: tyk
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    automated:
      prune: true
      selfHeal: true

Tyk app:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: tyk-helm-app
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    chart: tyk-headless
    repoURL: 'https://helm.tyk.io/public/helm/charts/'
    targetRevision: 0.14.0
    helm:
      releaseName: tyk-headless
      parameters:
        - name: redis.pass
          value: '[redis master password]'
        - name: redis.addrs
          value: 'redis-master.tyk.svc.cluster.local:6379'
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: tyk
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    automated:
      prune: true
      selfHeal: true

Cheers, Mike

2 Likes

thanks for sharing your configuration here! it helped me today :raised_hands:

Sonja

1 Like