繁体   English   中英

如何使用 Jenkins 在没有 docker 的情况下将 spring 引导应用程序部署到 kube.netes?

[英]How to deploy spring boot application to kubernetes without docker using Jenkins?

在我们的项目中,我们使用旧的和 depracted docker 插件:

    <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>1.2.0</version>
        <configuration>
            <imageName>${docker.image.name}</imageName>
            <imageTags>
                <imageTag>${project.version}</imageTag>
                <imageTag>latest</imageTag>
            </imageTags>
            <dockerDirectory>${basedir}/target/dockerfile</dockerDirectory>
            <resources>
                <resource>
                    <targetPath>/</targetPath>
                    <directory>${project.build.directory}</directory>
                    <include>${project.build.finalName}.jar</include>
                </resource>
            </resources>
        </configuration>
    </plugin>

和 Jenkins 使用 docker 中的技术 docker 将应用程序部署到 kube.netes。

问题是新版本的 kube.netes 只包含 containerd 而没有 docker。我不确定边界在哪里,什么仍然是 containerd 的一部分,什么不是(例如 dockerfile)。 是否已经有了如何在没有 docker 的情况下将应用程序部署到 kube.netes 的概念?

更新

我确信同样的工作不会起作用,因为在 Jenkins 容器中我们正在安装 docker 袜子:

  containers:
    - name: all
      image: ...
      command:
        - cat
      tty: true
      volumeMounts:
        - name: m2
          mountPath: /root/.m2
        - name: dockersock
          mountPath: /var/run/docker.sock
  volumes:
    - name: dockersock
      hostPath:
        path: /var/run/docker.sock
    - name: m2
      hostPath:
        path: /jenkins 

无需担心:您无需关心集群内部运行的是什么容器运行时,只要它可以在 OCI 或 docker 图像上运行即可。 将实际的容器运行时视为实现细节。

这是与构建图像不同的主题。 甚至还有像 Jib 或 Kaniko 这样的替代方案来使用 docker 守护进程和 Dockerfile。

如果您使用 jenkins 和 docker-as-a-container(docker-in-docker beeing 只是一个选项)构建您的图像,您甚至应该能够保持原样。

暂无
暂无

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

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