上下文:
我使用fabric8-maven-plugin生成对接映像,并将其部署到Kubernetes集群中。
问题:
可以配置默认值为imagePullPolicy IfNotPresent的参数
pom.xml中的当前配置
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>3.5.25</version>
<configuration>
<images>
<image>
<name>my-service</name>
<alias>service</alias>
<build>
<from>java:8</from>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
<!--
The entry point path used is "maven/" since this is the default folder: https://dmp.fabric8.io/#building-images,
"launch.sh" is copied to the container based in the assembly.xml descriptor file.
-->
<entryPoint>
<exec>
<arg>maven/launch.sh</arg>
</exec>
</entryPoint>
<assembly>
<descriptor>assembly.xml</descriptor>
</assembly>
</build>
</image>
</images>
<generator>
<includes>
<include>java-exec</include>
</includes>
<config>
<java-exec>
<webPort>8080</webPort>
</java-exec>
</config>
</generator>
</configuration>
</plugin>
</plugins>
</build>我得到的是:
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: 394148814603.dkr.ecr.us-east-1.amazonaws.com/dkrecr-nafiux-ncp/kcluster-ncp-myservice
imagePullPolicy: IfNotPresent <---- I want to personalize this value to Always, for instance.
name: service
securityContext:
privileged: false为什么要将值更改为 Why ?主要是因为我对集群做了很多测试,而且我不想为我所做的每一个测试分配一个新版本。
感谢你的支持。
发布于 2017-08-18 07:28:10
将以下内容与生成器、图像一起添加到pom.xml中。
<configuration>
<enricher>
<config>
<fmp-controller>
<pullPolicy>Always</pullPolicy>
</fmp-controller>
</config>
</enricher>
</configuration>虽然这不是理想的方式,但会暂时奏效。
https://stackoverflow.com/questions/45746984
复制相似问题