docker-compose translate to kubernetes

4/27/2020

i have a docker-compose.yaml

version: '3.4'

services:

  mongodb:
    image: mongo:latest

  assets:
    image: gnaudio/jabra-xpress-assets:v4.0.7020

  frontend:
    image: gnaudio/jabra-xpress-frontend:v4.0.7314
    environment:
    - "ENDPOINT=http://¤HOST-NAME¤:85"
    ports:
    - "80:80"

  backend:
    image: gnaudio/jabra-xpress-api:v4.0.7313
    environment:
    - "ConnectionStrings:XpressDatabaseSqlServer=¤CONNSTRING¤"
    - "ConnectionStrings:MongoDb=mongodb://mongodb/raw"
    - "DefaultAnalyticsEndpoint=http://¤HOST-NAME¤:88/api/v1/Analytics"
    - "JDODownload=http://assets/"
    - "NetworkEndpoint=http://¤HOST-NAME¤:85/api/Xpress/Network/"
    - "SDK:fwURL_base=http://¤HOST-NAME¤:82"
    - "SDK:fsURL_base=http://¤HOST-NAME¤:82"
    ports:
    - "85:80"
    depends_on:
    - mongodb
    - assets
    - sdkbackend

  sdkbackend:
    image: gnaudio/jabra-xpress-sdkbackend:latest
    environment:
    - "Storage:SDKCopyUrl=http://¤HOST-NAME¤:82"
    ports:
    - "82:80"

  analytics:
    image: gnaudio/jabra-xpress-analytics:v4.0.7312
    environment:
    - "ConnectionStrings:MongodbServer=mongodb://mongodb/raw"
    ports:
    - "88:80"
    depends_on:
    - mongodb

  analytics-cron:
    image: gnaudio/jabra-xpress-analytics-cron:v4.0.7313
    environment:
    - "MONGODBCONNECTIONSTRING=mongodb://mongodb/raw"
    depends_on:
    - mongodb

I know I can translate this with kompose up to kubernetes. But what is with the Parts "DefaultAnalyticsEndpoint=http://¤HOST-NAME¤:88/api/v1/Analytics"?

According to the producer of Jabra, you should do that:

Replace ¤CONNSTRING¤ with the SQL connection string Replace ¤HOST-NAME¤ with the server host-name.

What hostname I have to do put in there? I mean I have 6 different Services and Pods. How can they communicate with each other?

-- pablo
docker
docker-compose
kubernetes
openshift

1 Answer

4/27/2020

As with Docker(-Compose), Kubernetes includes a DNS service that permits you to reference e.g. Services (Capitalized means the Kubernetes type).

IIRC, Kompose generates Services and Deployments for Docker-Compose services. You will generally refer to Kubernetes services through the Service type and you should have Services for e.g. frontend, backend etc.

So, in answer to your question, depending on which Service you wish to reference, you will replace ${HOST_NAME} with one of the Service names. It would appear that DefaultAnalyticsEndpoint references the Docker-Compose service analytics. This should be mapped to a Kubernetes Service called analytics too. IIUC, in both case (Docker-Compose and Kubernetes), The HOST-NAME in DefaultAnalyticsEndpoint would be analytics.

If you reference a Service from within the same Namespace, you need only use the Service name e.g. backend. If you refer to a Service from another Namespace, you will need to include the Namespace specifier, e.g. backend.${NAMESPACE}.cluster.local

See:

-- DazWilkin
Source: StackOverflow