高级配置
Nocalhost 的开发配置支持多种开发方式,例如 ConfigMap,注释等。
实际上,这些配置方法**也适合**部署配置。 但是,需要通过 K8S Admission Webhook 来实现某些功能。 在 Nocalhost 中,一个称为Nocalhost-Dep
的组件扮演此角色,Nocalhost Server
将自动为您部署此组件。
if you do not use Nocalhost Server
, then additional deployment of Nocalhost Dep
is required.
Info
Nocalhost提供哪些部署配置? 介绍哪些部署配置需要额外部署nocalhost dep
.
使用 ConfigMap 进行部署配置¶
To make a simple deployment configuration is mentioned in Introduction to Deployment Configuration Nocalhost Basic Deployment Configuration. Combining with What configuration methods are supported by Nocalhost-place the configuration in configmap, we can get the configuration:
We have prepared an demo for this, which will automatically deploy Nocalhost Dep
, and use the way of ConfigMap to make the deployment configuration.
Using the following commands to try out this demo (trying the Chart package requires ClusterAdmin)
Then use Helm to install:
The content of the deployment configuration itself will not be repeated here. let's take a look at charts/bookinfo/templates/nocalhost-app-config.yaml
.
Danger
This ConfigMap requires to apply to Api Server first. For example, in the Helm application scenario, it should be declared as pre-install
.
It introduces .Values.nocalhost.config.path
to render the main body of the deployment configuration. The configuration is actually declared in ./charts/bookinfo/example/config-from-cm/nocalhost-full-config.yaml
, which is a standard Nocalhost deployment configuration without any additional modification:
使用注释进行部署配置¶
The method of usage is exactly the same as Which configuration methods Nocalhost supports-place the configuration in annotations.
Extra attention
Since Annotations closely follow the workload, some configurations at the application level are not supported. Only the configurations under application.services
is supported.
Again, use the same demo project:
Use the following commands to get and try out this project (trying the Chart package requires ClusterAdmin)
Then use Helm to install:
We specified values-annotation-config.yaml
as Values.yaml, which specifies the rendering of the local configuration file to the Annotations of the workload. Take ./charts/bookinfo/templates/microservice-details.yaml
as an !!! example
Helm will render the path configured by .Values.nocalhost.annotations.path.details
into yaml, whose content is as follows, that is, ./charts/bookinfo/example/config-from-annotations/details.yaml
specified in Values :
如何部署 Nocalhost Dep
¶
我们建议使用Nocalhost Server
获取Nocalhost Dep
的所有功能。
Danger
即将推出