skip to Main Content

Note: solution can use netcat or any other built-in Linux utility

I need to implement an initContainer and liveness probe that confirms my redis pod is up for one of my redis dependent pods. I have attempted the netcat solution offered as the answer here ((printf "PINGrn"; sleep 1) | nc 10.233.38.133 6379) but I get -NOAUTH Authentication required. error in response. Any way around this? I am aware I could install redis-cli or make a management command in my Django code but would prefer not to. Nor do I want to implement a web server for my Redis instance and use curl command.

2

Answers


  1. You could always send in your AUTH command as part of your probe, like:

    `"AUTH ....rnPINGrn"`
    

    Unless you’re getting INFO from the server, you don’t seem to care about the nature of the response, so no auth is required, just test for NOAUTH.

    Login or Signup to reply.
  2. Here’s the initContainers stanza that you can use:

      initContainers:
        - name: wait-for-redis
          image: busybox
          command:
          - /bin/sh
          - -c
          - >
            set -x;
            until ((printf "AUTH <password>rn"; sleep 1) | nc <redis-host> 6379);
            do echo waiting for redis;
            sleep 2; done
    

    Just don’t forget to change <redis-host> and <password> to their values.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search