[英]docker-compose translate to kubernetes
i have a docker-compose.yaml我有一个 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.我知道我可以用 kompose 将它翻译到 kubernetes。 But what is with the Parts "DefaultAnalyticsEndpoint=http://¤HOST-NAME¤:88/api/v1/Analytics"?但是“DefaultAnalyticsEndpoint=http://¤HOST-NAME¤:88/api/v1/Analytics”部分是什么?
According to the producer of Jabra, you should do that:根据 Jabra 的制作人的说法,您应该这样做:
Replace ¤CONNSTRING¤ with the SQL connection string Replace ¤HOST-NAME¤ with the server host-name.将 ¤CONNSTRING¤ 替换为 SQL 连接字符串 将 ¤HOST-NAME¤ 替换为服务器主机名。
What hostname I have to do put in there?我必须在里面放什么主机名? I mean I have 6 different Services and Pods.我的意思是我有 6 个不同的服务和 Pod。 How can they communicate with each other?他们如何相互交流?
As with Docker(-Compose), Kubernetes includes a DNS service that permits you to reference eg Services (Capitalized means the Kubernetes type).与 Docker(-Compose) 一样,Kubernetes 包括一个 DNS 服务,该服务允许您引用例如服务(大写字母表示 Kubernetes 类型)。
IIRC, Kompose generates Services and Deployments for Docker-Compose services. IIRC,Kompose 为 Docker-Compose 服务生成服务和部署。 You will generally refer to Kubernetes services through the Service type and you should have Services for eg frontend
, backend
etc.您通常会通过服务类型引用 Kubernetes 服务,并且您应该有服务,例如frontend
、 backend
等。
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.因此,在回答您的问题时,根据您希望引用的服务,您将${HOST_NAME}
替换为服务名称之一。 It would appear that DefaultAnalyticsEndpoint
references the Docker-Compose service analytics
.似乎DefaultAnalyticsEndpoint
引用了 Docker-Compose 服务analytics
。 This should be mapped to a Kubernetes Service called analytics
too.这也应该映射到称为analytics
的 Kubernetes 服务。 IIUC, in both case (Docker-Compose and Kubernetes), The HOST-NAME
in DefaultAnalyticsEndpoint
would be analytics
. IIUC,在这两种情况下(Docker-Compose 和 Kubernetes), DefaultAnalyticsEndpoint
中的HOST-NAME
都是analytics
。
If you reference a Service from within the same Namespace, you need only use the Service name eg backend
.如果您从同一命名空间中引用服务,则只需使用服务名称,例如backend
。 If you refer to a Service from another Namespace, you will need to include the Namespace specifier, eg backend.${NAMESPACE}.cluster.local
如果您从另一个命名空间引用服务,则需要包含命名空间说明符,例如backend.${NAMESPACE}.cluster.local
See:看:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.