在容器中仅包含某些部分的情况下运行应用程序 [英] Running application with only some parts in a container

查看:63
本文介绍了在容器中仅包含某些部分的情况下运行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道由Kubernetes管理的应用程序,例如 Jupiter 是否可以正常工作它的某些元素(例如CIRCE调度程序)是在没有容器的情况下使用的.

I wanted to know if an application which is being managed by Kubernetes, like Jupiter would work if some elements of it like the CIRCE dispatcher are used without a container.

如果是,那么大致上需要进行哪种更改?另外,是否有任何资源可供我阅读?谢谢!!

If yes, then broadly what kind of changes are required to be made? Also, are there any resources from where I can read up on this? Thanks !!

推荐答案

是的,您可以将任何外部组件(部署在 kuberntes集群之外)与集群中运行的组件集成在一起,从而使其成为您的应用程序体系结构不可或缺的一部分.

Yes, you can integrate any external component (deployed outside your kuberntes cluster) with components running within the cluster, so that it becomes an integral part of your application architecture.

您可以使用所谓的无需选择器.

其最常见的用例在kubernetes文档中进行了描述,但实际上可用于将任何外部组件与kubernetes集群集成:

Its most common use cases are described in kubernetes documentation but it can be used to integrate practically any external component with your kubernetes cluster:

服务最常见的是对Kubernetes Pod的抽象访问,但是它们 还可以提取其他种类的后端.例如:

Services most commonly abstract access to Kubernetes Pods, but they can also abstract other kinds of backends. For example:

  • 您希望在生产中使用外部数据库集群,但是在测试环境中,您将使用自己的数据库.
  • 您想将您的服务指向其他命名空间 或在另一个群集上.
  • 您正在将工作负载迁移到Kubernetes.在评估该方法的同时,您仅在Kubernetes中运行一部分后端.
  • You want to have an external database cluster in production, but in your test environment you use your own databases.
  • You want to point your Service to a Service in a different Namespace or on another cluster.
  • You are migrating a workload to Kubernetes. Whilst evaluating the approach, you run only a proportion of your backends in Kubernetes.

在下面的示例中,它看起来可能是这样的:

Below you have example how it may look like:

在上述任何一种情况下,您都可以在没有Pod的情况下定义服务 选择器.例如:

In any of these scenarios you can define a Service without a Pod selector. For example:

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376

因为此服务没有选择器,所以相应的端点 对象是 not 自动创建的.您可以手动映射 通过添加到运行所在的网络地址和端口的服务 手动设置Endpoint对象:

Because this Service has no selector, the corresponding Endpoint object is not created automatically. You can manually map the Service to the network address and port where it’s running, by adding an Endpoint object manually:

apiVersion: v1
kind: Endpoints
metadata:
  name: my-service
subsets:
  - addresses:
      - ip: 192.0.2.42
    ports:
      - port: 9376

在没有选择器的情况下访问服务的方式与在服务中具有选择器的方式相同 选择器.在上面的示例中,流量被路由到单个 YAML中定义的终结点:192.0.2.42:9376(TCP).

Accessing a Service without a selector works the same as if it had a selector. In the example above, traffic is routed to the single endpoint defined in the YAML: 192.0.2.42:9376 (TCP).

还要看看ExternalName,这是一种特殊的Service,没有选择器:

Also take a look at ExternalName which is a special kind of Service without a selector:

ExternalName ServiceService的特例, 没有选择器,而是使用DNS名称.欲获得更多信息, 看到 外部名称

An ExternalName Service is a special case of Service that does not have selectors and uses DNS names instead. For more information, see the ExternalName section later in this document.

您还可以阅读这两篇文章,它们基本上解释了同一件事:

You can also read this two articles which basically explain the same thing:

Kubernetes最佳做法:映射外部服务

Kubernetes访问外部服务

请告诉我是否有帮助.如果没有,请更详细地说明您想要达到的理想状态.

Please let me know if it helps. If not, please explain in more detail the desired state you want to achieve.

这篇关于在容器中仅包含某些部分的情况下运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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