JKube doesn't create imagePullSecret

11/18/2021

I tried to use JKube maven plugin. I have a private docker repository, I specified it in my pom.xml, like this:

<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>

it creates hello-world-secrets and it contains everything very well. But plugin doesn't create imagePullSecret in generated helloworld-deployment.yml. And then I tried to create a template in my src/main/jkube directory named deployment.yaml:

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

but plugin didn't generate a deployment containing imagePullSecret. How can I specify my private docker registry?

thx, Zamek

-- zamek z
jkube
kubernetes
maven-plugin

1 Answer

11/19/2021

It was my mistake, because my template was wrong. this is the right deployment.yaml:

---
spec:
  template:
    spec:
      imagePullSecrets:
        - name: hello-world-secret
-- zamek z
Source: StackOverflow