0

我尝试使用 JKube maven 插件。我有一个私有 docker 存储库,我在 pom.xml 中指定了它,如下所示:

<plugin>
        <groupId>org.eclipse.jkube</groupId>
        <artifactId>kubernetes-maven-plugin</artifactId>
        <version>${jkube.version}</version>
        <configuration>
          <registry>zamek.xxx:nnnn</registry>
          <images>
            <image>
              <name>helloworld-java:${project.version}</name>
              <alias>hello-world</alias>
              <build>
                <from>openjdk:latest</from>
                <cmd>java -jar maven/${project.artifactId}-${project.version}.jar</cmd>
              </build>
              <run>
                <wait>
                  <log>Hello World!</log>
                </wait>
              </run>
            </image>
          </images>
          <resources>
            <secrets>
              <secret>
                <dockerServerId>zamek.xxx:nnnn</dockerServerId>
                <name>hello-world-secret</name>
              </secret>
            </secrets>
          </resources>
        </configuration>
      </plugin>
    </plugins>
  </build>

它创建了 hello-world-secrets 并且它包含了所有内容。但是插件不会在生成的 helloworld-deployment.yml 中创建 imagePullSecret。然后我尝试在我的 src/main/jkube 目录中创建一个名为 deployment.yaml 的模板:

---
spec:
  imagePullSecrets:
    -name: hello-world-secret

但插件没有生成包含 imagePullSecret 的部署。如何指定我的私人 Docker 注册表?

谢谢,扎梅克

4

1 回答 1

0

这是我的错误,因为我的模板是错误的。这是正确的部署.yaml:

---
spec:
  template:
    spec:
      imagePullSecrets:
        - name: hello-world-secret
于 2021-11-19T15:54:39.280 回答