quarkus deploy in new Quarkus 3: how should it work with Kubernetes?

huangapple go评论67阅读模式
英文:

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
  1. 构建容器(我推荐使用 jib)并将其推送到注册表
  2. 生成 Kubernetes 描述文件并应用它们

我经常将它们链接在一起:

> quarkus build --clean -Dquarkus.container-image.push=true -DskipTests && quarkus deploy kubernetes

参考链接:

英文:

Let me give you my magic command trick:

> quarkus build --clean -Dquarkus.container-image.push=true -DskipTests
> quarkus deploy kubernetes
  1. Build the container (I recommend jib) and push it to a registry
  2. 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

huangapple
  • 本文由 发表于 2023年6月5日 00:16:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76401336.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定