具有多个资源的Kubernetes应用程序单个YAML [英] Kubernetes Application with multiple Resources single YAML

查看:82
本文介绍了具有多个资源的Kubernetes应用程序单个YAML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我使用docker-compose来安排由3个dockerimages组成的应用程序-一个postgresql数据库和2个wildfly应用程序服务器(Frontend-ui,后端).

currently i used docker-compose to arrange my application that consists of 3 dockerimages - a postgresql database and 2 wildfly application servers (Frontend-ui, backend).

我的 docker-compose.yml 如下:

version: '3.0'
services:
  my-webgui-service:
    image: test/mywebgui
    ports:
    - "18081:8080"
    links:
    - my-app-service
  my-app-service:
    image: test/myapp
    ports:
    - "18080:8080"
    - "29990:9990"
    links:
    - db-service
  db-service:
    image: test/postgres
    ports:
    - "15432:5432

现在,我想通过kubernetes实现同样的事情.

Now, i would like to implement the same thing via kubernetes.

是否可以将其安排在单个yaml文件中,该文件包含服务,部署和Pod的配置? 我认为当没有单独的yml文件时,管理自动化部署会更容易.

Is it possible to arrange this in a single yaml-File, that contains the configuration for service, deployment and pods? I thought that it is easier to manage automated deployments when not having seperated yml-files.

这是最好的做法吗?

最诚挚的问候,Shane

Best regards, Shane

推荐答案

是的,可以简单地使用---分隔不同的资源,例如部署,服务等.关于这是否是一个好习惯:而是关于品味的问题.如果您将所有文件放在一个文件中,则文件将更加独立,但是对于kubectl apply -f而言,这并不重要,因为它也可以在目录上运行.

Yes it's possible, simply separate the different resources such as deployments, services, etc. with ---. Concerning if it's a good practice or not: a matter of taste, rather. If you have all in one file it's more self-contained but for kubectl apply -f it doesn't really matter since it operates on directories as well.

这篇关于具有多个资源的Kubernetes应用程序单个YAML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆