英文:
quarkus deploy in new Quarkus 3: how should it work with Kubernetes?
问题
"Quarkus 3发布说明中提到:
> 此版本包括额外的功能,如quarkus deploy命令,可以将Quarkus应用程序部署到像Kubernetes、Knative和OpenShift这样的平台,而无需更改项目的依赖关系或配置
但是,
quarkus deploy kubernetes # 或者 minikube
与
./mvnw clean package -Dquarkus.kubernetes.deploy=true
不同。我使用了生成器的默认REST示例,添加了Docker和Kubernetes扩展,设置了环境,将image-pull-policy=ifNotPresent添加到application.properties中,并尝试部署到运行在Windows 11上的Docker桌面上的Minikube。
在第一个情况下,它不会构建与Docker相关的任何内容并启动一个pod,在第二个情况下,一切都正常运行。
如何正确使用quarkus命令呢?"
英文:
The release notes of Quarkus 3 state
> This release includes additional features like the quarkus deploy
> command that enables the deployment of Quarkus applications to
> platforms like Kubernetes, Knative, and OpenShift without requiring
> changes to the project dependencies or configuration
But a
quarkus deploy kubernetes # or minikube
does not the same as
./mvnw clean package -Dquarkus.kubernetes.deploy=true
I used the default REST sample from the generator, added Docker and Kubernetes extension, set the environment, added image-pull-policy=ifNotPresent to application.properties and tried to deploy into a running Minikube on Docker Desktop on Windows 11.
In the 1st case, it would not build anything docker related and start a pod, in the 2nd case everything runs fine.
How should the quarkus command be used?
答案1
得分: 2
Sure, here is the translated content:
让我告诉你我的魔法命令技巧:
> quarkus build --clean -Dquarkus.container-image.push=true -DskipTests
> quarkus deploy kubernetes
- 构建容器(我推荐使用 jib)并将其推送到注册表
- 生成 Kubernetes 描述文件并应用它们
我经常将它们链接在一起:
> quarkus build --clean -Dquarkus.container-image.push=true -DskipTests && quarkus deploy kubernetes
参考链接:
- jib 配置示例: https://github.com/holly-cummins/redis-cache-cache/blob/europe/player-service/src/main/resources/application.properties#L16-L19
- https://quarkus.io/guides/container-image#jib
- https://quarkus.io/guides/deploying-to-kubernetes
英文:
Let me give you my magic command trick:
> quarkus build --clean -Dquarkus.container-image.push=true -DskipTests
> quarkus deploy kubernetes
- Build the container (I recommend jib) and push it to a registry
- Generate the kubernetes descriptor and apply them
I often chain them:
> quarkus build --clean -Dquarkus.container-image.push=true -DskipTests && quarkus deploy kubernetes
References:
答案2
得分: 1
请注意,Quarkus构建还具有--image-build
标志,它也会触发镜像构建。
英文:
Note that quarkus build also has the flag --image-build
that will also trigger the image build.
答案3
得分: 0
我自己解决了。但我觉得有点不直观:
./mvnw clean package -Dquarkus.kubernetes.deploy=true
与
./mvnw clean package
quarkus deploy
并不相同,因为在打包步骤之后,需要单独构建镜像:
quarkus image build
英文:
Ok, I solved it myself. But I think it's a bit unintuitive:
./mvnw clean package -Dquarkus.kubernetes.deploy=true
is not identical with
./mvnw clean package
quarkus deploy
after package step, the images have to be build separately:
quarkus image build
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论