Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 Support on Kubernetes #10397

Closed
1 of 3 tasks
RomLecat opened this issue Jun 16, 2024 · 5 comments
Closed
1 of 3 tasks

IPv6 Support on Kubernetes #10397

RomLecat opened this issue Jun 16, 2024 · 5 comments

Comments

@RomLecat
Copy link

RomLecat commented Jun 16, 2024

The bug

Immich cannot connect to Redis in Kubernetes in Dual-Stack mode because it only resolves IPv4 for Redis service, when the service is IPv6-only (and not configurable due to Bitnami's Redis chart).

It results in the following error in loop (because the service only has AAAA record and no A records):

Error: getaddrinfo ENOTFOUND immich-redis-master
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  errno: -3007,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'immich-redis-master'
}

The OS that Immich Server is running on

K8s v1.28.10

Version of Immich Server

1.106.4

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

1. Run Immich with its Helm chart on a dual-stack (or IPv6-only) K8s cluster

Relevant log output

No response

Additional information

No response

@bo0tzz
Copy link
Member

bo0tzz commented Jun 16, 2024

I'm not quite sure where this is going wrong, but it doesn't quite seem like an Immich issue to me. This seems like either an issue with the bitnami chart or kubernetes dns, or with how the redis library we use resolves the address.

@RomLecat
Copy link
Author

RomLecat commented Jun 16, 2024

The Bitnami charts indeed lacks configuration by not providing ipFamily and/or ipFamilyPolicy, but an IPv6-only service should be working in the first place.

Kubernetes DNS works fine, tested by installing ping in the pod then running:

root@immich-server-954d7b649-mqgj6:/usr/src/app# ping immich-redis-master
PING immich-redis-master(immich-redis-master.immich.svc.cluster.local (<ipv6-prefix-redacted>:701::2:c924)) 56 data bytes
^C
--- immich-redis-master ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

root@immich-server-954d7b649-mqgj6:/usr/src/app# ping immich-redis-master -4
ping: immich-redis-master: Address family for hostname not supported

This is expected because the service is IPv6-only, so AAAA records works fine but querying A returns no host.

It does looks like an error in ioredis: https://github.com/redis/ioredis/blob/main/lib/redis/RedisOptions.ts#L201
This issue: mastodon/mastodon#27043 seems to mention a workaround by setting ?family= in the URL. Is there a way to provide a full Redis URL to Immich ?

@bo0tzz
Copy link
Member

bo0tzz commented Jun 16, 2024

You can set REDIS_URL (see https://immich.app/docs/install/environment-variables#redis), which expects base64-encoded json matching the RedisOptions type you linked.

@RomLecat
Copy link
Author

Thanks, that did work!
It does not seem very "standard" however, REDIS_URL usually refers to an URL like this : "redis://hostname:port/?options".

@bo0tzz
Copy link
Member

bo0tzz commented Jun 16, 2024

It was done this way to support redis sentinel, which I believe isn't possible through that (admittedly more sensible) URL format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants