简体   繁体   English

如何分配Kubernetes Pod的负载?

[英]How can I distrubute loads to Kubernetes Pods?

I have work defined in a file/config with the following format, 我在文件/配置中使用以下格式定义了工作,

config1,resource9
config3,resource21
config5,resource10

How can I spin individual pods based on the configuration? 如何根据配置旋转单个吊舱? If I add one more line to the configuration, Kubernetes need to spin one more pod and send the configuration line to that pod. 如果我在配置中增加一行,Kubernetes需要再旋转一个Pod并将配置行发送到该Pod。

How to store the configuration in Kubernetes and spin up pods based on the configuration? 如何将配置存储在Kubernetes中并根据配置旋转Pod?

Take a look at Kubernetes Operators . 看一下Kubernetes运算符 The pattern adds a Kubernetes management layer to an application. 该模式将Kubernetes管理层添加到应用程序。 Basically you run a kubernetes native app (the operator) that connects to the kubernetes API and takes care of the deployment management for you. 基本上,您运行一个kubernetes本机应用程序(操作员),该应用程序连接到kubernetes API,并为您进行部署管理。

If you are familiar with helm, then a quick way to get started is with the helm example . 如果您熟悉掌舵,那么快速入门方法就是掌舵示例 This example will create a new Nginx deployment for each Custom Resource you create. 本示例将为您创建的每个自定义资源创建一个新的Nginx部署。 The Custom Resource contains all the helm values nginx requires for a deployment. 自定义资源包含nginx部署所需的所有helm值。

As a first step you could customise the example so that all you need to do is manage the single Custom Resource to deploy or update the app. 首先,您可以自定义示例,以便您只需管理一个自定义资源即可部署或更新应用程序。

If you want to take it further then you may run into some helm limitations pretty quickly, for advanced use cases you can use the go operator-sdk directly. 如果您想进一步扩展它,则可能会很快遇到一些头盔限制,对于高级用例,您可以直接使用go operator-sdk

There are a number of projects operators to browse on https://operatorhub.io/ 有许多项目运营商可以在https://operatorhub.io/上浏览

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM