[BUG] Can't deploy in kubernetes because of "_" characters #51

Closed
opened 2026-02-04 16:59:56 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @chasx003 on GitHub (Apr 6, 2022).

Describe the bug
This application can't be deployed in a Kubernetes cluster as the service names have underscores hardcoded, and underscores can't be used in a kubernetes service name.

Ideas for a fix would be changing resource names to things like "immich-redis" , or to make it a less breaking change, allow the services to be optionally set via environment variables, with default values being what they currently are today

Originally created by @chasx003 on GitHub (Apr 6, 2022). **Describe the bug** This application can't be deployed in a Kubernetes cluster as the service names have underscores hardcoded, and underscores can't be used in a kubernetes service name. Ideas for a fix would be changing resource names to things like "immich-redis" , or to make it a less breaking change, allow the services to be optionally set via environment variables, with default values being what they currently are today
Author
Owner

@alextran1502 commented on GitHub (Apr 6, 2022):

Interesting, I haven't touched K8 so I have no knowledge about what is allowed in the setup. I am happy to accommodate though. Can you please show a snippet example of how the service name should be in the docker-compose file?

edit: wording

@alextran1502 commented on GitHub (Apr 6, 2022): Interesting, I haven't touched K8 so I have no knowledge about what is allowed in the setup. I am happy to accommodate though. Can you please show a snippet example of how the service name should be in the docker-compose file? edit: wording
Author
Owner

@chasx003 commented on GitHub (Apr 7, 2022):

  redis:
    container_name: immich-redis
    image: redis:6.2
    networks:
      - immich_network

something like this would work, but the issue I think is really from
some of these hardcoded paths

a3b84b3ca7/server/src/app.module.ts (L30)
fe693db84f/server/src/middlewares/redis-io.adapter.middleware.ts (L11)
a3b84b3ca7/server/src/modules/background-task/background-task.processor.ts (L118)
a3b84b3ca7/server/src/modules/background-task/background-task.processor.ts (L137)
dd9c5244fd/microservices/src/config/database.config.ts (L5)
fe693db84f/server/src/config/database.config.ts (L11)

I'm not really sure how other apps handle it really, like if they are environment variables or what

@chasx003 commented on GitHub (Apr 7, 2022): ``` redis: container_name: immich-redis image: redis:6.2 networks: - immich_network ``` something like this would work, but the issue I think is really from some of these hardcoded paths https://github.com/alextran1502/immich/blob/a3b84b3ca7c23f6de8f741364db100a305068604/server/src/app.module.ts#L30 https://github.com/alextran1502/immich/blob/fe693db84f4ceadb7e48742b84020e7687be4521/server/src/middlewares/redis-io.adapter.middleware.ts#L11 https://github.com/alextran1502/immich/blob/a3b84b3ca7c23f6de8f741364db100a305068604/server/src/modules/background-task/background-task.processor.ts#L118 https://github.com/alextran1502/immich/blob/a3b84b3ca7c23f6de8f741364db100a305068604/server/src/modules/background-task/background-task.processor.ts#L137 https://github.com/alextran1502/immich/blob/dd9c5244fda36b24f3e94fce1b7cbd815a4393f7/microservices/src/config/database.config.ts#L5 https://github.com/alextran1502/immich/blob/fe693db84f4ceadb7e48742b84020e7687be4521/server/src/config/database.config.ts#L11 I'm not really sure how other apps handle it really, like if they are environment variables or what
Author
Owner

@alextran1502 commented on GitHub (Apr 7, 2022):

Ah I see. I am having a similar issue while trying to put the whole app in the container. I think the environment variable will be able to fix this. I don't have time to work on this at the moment but as soon as I have this figured out, I will let you know

@alextran1502 commented on GitHub (Apr 7, 2022): Ah I see. I am having a similar issue while trying to put the whole app in the container. I think the environment variable will be able to fix this. I don't have time to work on this at the moment but as soon as I have this figured out, I will let you know
Author
Owner

@chasx003 commented on GitHub (Apr 11, 2022):

(Offtopic, and this is totally my opinion, this is your app, so please feel free to ignore this if you want, doesn't hurt my feelings.)
From looking at one of the branches you have, it looks like you're trying to put the entire stack into one container. IMO, I wouldn't do that, its not considered "docker best practice", and I feel like it puts a lot more work on you as a dev to keep your container secure (not only do you need to worry about security updates to dependencies in your code, but also would need to worry about updating your container if there was a new update for postgres or something). I think current docker-compose approach is fairly "normal" and people are typically used to spinning up a DB for their app

@chasx003 commented on GitHub (Apr 11, 2022): (Offtopic, and this is totally my opinion, this is your app, so please feel free to ignore this if you want, doesn't hurt my feelings.) From looking at one of the branches you have, it looks like you're trying to put the entire stack into one container. IMO, I wouldn't do that, its not considered "docker best practice", and I feel like it puts a lot more work on you as a dev to keep your container secure (not only do you need to worry about security updates to dependencies in your code, but also would need to worry about updating your container if there was a new update for postgres or something). I think current docker-compose approach is fairly "normal" and people are typically used to spinning up a DB for their app
Author
Owner

@alextran1502 commented on GitHub (Apr 11, 2022):

I was testing the idea of building an image for Unraid's users. I agree with you that it is more complicated to maintain. I have no plan of deprecated docker-compose setup though, it is my preferred method.

@alextran1502 commented on GitHub (Apr 11, 2022): I was testing the idea of building an image for Unraid's users. I agree with you that it is more complicated to maintain. I have no plan of deprecated docker-compose setup though, it is my preferred method.
Author
Owner

@chasx003 commented on GitHub (Apr 11, 2022):

Ah, gotcha, I forget about unraid :)

I've tested this https://github.com/chasx003/immich/tree/117-service-names in my environment, and am able to to spin it up in k8 now, I think because of the environment variables in the Dockerfiles, this won't cause any issues to any existing docker-compose deployments, but I didn't actually test that

@chasx003 commented on GitHub (Apr 11, 2022): Ah, gotcha, I forget about unraid :) I've tested this [https://github.com/chasx003/immich/tree/117-service-names](https://github.com/chasx003/immich/tree/117-service-names) in my environment, and am able to to spin it up in k8 now, I think because of the environment variables in the Dockerfiles, this won't cause any issues to any existing docker-compose deployments, but I didn't actually test that
Author
Owner

@alextran1502 commented on GitHub (Apr 25, 2022):

I am closing this issue, if you have any further questions, please reopen the issue.

@alextran1502 commented on GitHub (Apr 25, 2022): I am closing this issue, if you have any further questions, please reopen the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#51