gpt4 book ai didi

kubernetes - 如何在OpenShift上为我的应用程序选择名称

转载 作者:行者123 更新时间:2023-12-02 12:03:58 24 4
gpt4 key购买 nike

我使用以下命令在Openshift上部署了应用程序:

oc project <projectname>

然后,导航到应用程序的目录并使用以下命令:
mvn fabric8:deploy -Popenshift

这可以完美地部署到Openshift。

唯一的问题是它会自动为我的应用程序命名,但我不确定它从何处获取名称。我想将其更改为[app-name] -test,[app-name] -dev等

那么,它是从哪里获得应用程序名称的,我该如何更改呢?

最佳答案

它通常在fabric8的XML配置中(pom.xml)。例如:

<configuration>
<!-- Standard d-m-p configuration which defines how images are build, i.e. how the docker.tar is created -->
<images>
<image>
<name>${image.user}/${project.artifactId}:${project.version}</name>
<!-- "alias" is used to correlate to the containers in the pod spec -->
<alias>camel-service</alias>
<build>
<from>fabric8/java</from>
<assembly>
<basedir>/deployments</basedir>
<descriptorRef>artifact-with-dependencies</descriptorRef>
</assembly>
<env>
<JAVA_LIB_DIR>/deployments</JAVA_LIB_DIR>
<JAVA_MAIN_CLASS>org.apache.camel.cdi.Main</JAVA_MAIN_CLASS>
</env>
</build>
</image>
</images>
<!-- resources to be created -->
<resources>
<!-- Labels that are applied to all created objects -->
<labels>
<group>quickstarts</group>
</labels>
<!-- Definition of the ReplicationController / ReplicaSet. Any better name than "containers" ? -->
<deployment>
<!-- Name of the replication controller, which will have a sane default (container alisa, mvn coords, ..) -->
<!-- Override here -->
<name>${project.artifactId}</name>
...

它默认为 ${project.artifactId},但您可以使用 ${project.artifactId}-dev之类的内容覆盖任何内容。您还可以在Kubernetes中手动编辑部署:
$ kubectl edit deployment ${project.artifactId}

关于kubernetes - 如何在OpenShift上为我的应用程序选择名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56640304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com