containers / podman-desktop

Podman Desktop is the best free and open source tool to work with Containers and Kubernetes for developers. Get an intuitive and user-friendly interface to effortlessly build, manage, and deploy containers and Kubernetes — all from your desktop.
https://podman-desktop.io
Apache License 2.0
4.79k stars 303 forks source link

Deploy to Kubernetes: Service conversion isn't very good with multi-container environments. #4725

Open cdrage opened 11 months ago

cdrage commented 11 months ago

Is your enhancement related to a problem? Please describe

I ran into another issue with converting to Kubernetes, to be honest the conversion from the group of compose containers to Kubernetes is done.. poorly with regards to services and being able to access them through the namespace.

For example, if we were to deploy only ONE container, it would be converted correctly. But say if we were to deploy multiple containers where they would be able to access each-other via services? For example, within a frontend container, you can ping redis-master, it will not work due to the way we are converting services.

When converting this example:

services:

  redis-master:
    container_name: redis-master
    image: redis:latest
    ports:
      - "6379"

  redis-replica:
    container_name: redis-replica
    image: redis:latest
    ports:
      - "6379"
    command: redis-server --replicaof redis-master 6379
    depends_on:
      - redis-master

  frontend:
    container_name: frontend
    image: cdrage/frontend
    #build: ./frontend
    ports:
      - "8080:8080"

I'm unable to access the "redis-replica" service as well as the "redis-master" service because Podman Desktop / Podman generates the following service:

apiVersion: v1
kind: Service
metadata:
  name: redis-replica-pod-35967
  namespace: default
spec:
  ports:
    - name: redis-replica-pod-35967
      protocol: TCP
      port: 35967
      targetPort: 6379
  selector:
    app: redis-replica-pod

When it should be creating this (example from a kompose conversion which works):

apiVersion: v1
kind: Service
metadata:
  name: redis-replica
spec:
  ports:
    - name: "6379"
      port: 6379
      targetPort: 6379

TLDR: When working with multiple containers with compose, it does not work well at all when converting to Kubernetes. 1 container is okay though.

Originally posted by @cdrage in https://github.com/containers/podman-desktop/issues/3345#issuecomment-1803022622

Describe the solution you'd like

Improvements is:

Take inspiration from kompose with regards to conversion practices for services.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had activity in the last 6 months. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

github-actions[bot] commented 4 months ago

This issue has been automatically closed because it has not had any further activity in the last 30 days. Thank you for your contributions!

cdrage commented 4 months ago

Still valid