Varnish admin socket timeout with magento 1 in kubernetes

12/17/2019

Outline:

We are trying to connect up varnish-4.1.11 to magento 1 in kubernetes using the nexcess turpentine addon, but the same error is returned each time:

Error determining Varnish version: Varnish admin socket timeout
Failed to load configurator

Application stack:

We have a kubernetes cluster running a magento 1 stack with the following containers:

  • php-fpm:7.2/nginx:latest
  • mysql:5.7
  • redis:latest
  • nfs-provisioner:latest
  • nginx:latest (acts as a proxy for varnish to point to)
  • varnish:4.1.11

kubernetes info:

  • Networking: cilium:v16.3
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:07:57Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

Varnish config:

NFILES=131072
MEMLOCK=82000
NPROCS="unlimited"
RELOAD_VCL=1
VARNISH_VCL_CONF=/var/www/html/site/var/default.vcl
VARNISH_LISTEN_PORT=6081
VARNISH_ADMIN_LISTEN_PORT=6082
VARNISH_SECRET_FILE=/etc/varnish/secret
VARNISH_MIN_THREADS=5
VARNISH_MAX_THREADS=50
VARNISH_THREAD_TIMEOUT=120
VARNISH_STORAGE="malloc,512M"
VARNISH_TTL=120

DAEMON_OPTS="-F -a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
             -f ${VARNISH_VCL_CONF} \
             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
             -t ${VARNISH_TTL} \
             -S ${VARNISH_SECRET_FILE} \
             -s ${VARNISH_STORAGE}" \
             -p esi_syntax=0x2 \
             -p cli_buffer=16384

What we've tried so far:

  • Downgrading to varnish-3.0.7
  • Pointing magento to varnish's IP directly
  • Running a generic varnish connection script in PHP

Notes:

  • Pinging the varnish pod from the nginx/fpm pod works fine
  • Curling to the varnish ports from the nginx/fpm pod also works fine
  • The generic connection script noted above works successfully when run from inside the varnish container itself, which very likely indicates a networking issue.
  • Running the stack locally in docker-compose works fine, which also indicates a networking issue.

I appreciate that this is a very very niche issue, but hopefully someone else has some insight into what could be going wrong.

-- K266
kubernetes
magento
nginx
php
varnish

1 Answer

1/3/2020

In case anyone else encounters this or a similar issue, it was due to the linkerd service mesh we have in place not properly passing traffic.

Whilst not an ideal solution, disabling linkerd for the relevant pods resolved the issue.

-- K266
Source: StackOverflow