org.springframework.boot
spring-boot-maven-plugin
${spring-boot.version}
repackage
org.apache.maven.plugins
maven-deploy-plugin
${maven-deploy-plugin.version}
true
org.apache.maven.plugins
maven-surefire-plugin
${maven-surefire-plugin.version}
true
false
io.fabric8
fabric8-maven-plugin
${fabric8.maven.plugin.version}
fmp
resource
kubernetes
io.fabric8
fabric8-maven-plugin
${fabric8.maven.plugin.version}
fmp
resource
build
NodePort
- 以上就是webdemo应用的内容了,接下来要编译、构建、部署到minikube环境,在pom.xml执行以下命令即可:
mvn clean install fabric8:deploy -Dfabric8.generator.from=fabric8/java-jboss-openjdk8-jdk -Pkubernetes
部署完成后终端输出类似如下成功信息:
[INFO]
[INFO] <<< fabric8-maven-plugin:3.5.37:deploy (default-cli) < install @ webdemo <<<
[INFO]
[INFO]
[INFO] — fabric8-maven-plugin:3.5.37:deploy (default-cli) @ webdemo —
[INFO] F8: Using Kubernetes at https://192.168.121.133:8443/ in namespace default with manifest /usr/local/work/k8s/webdemo/target/classes/META-INF/fabric8/kubernetes.yml
[INFO] Using namespace: default
[INFO] Updating a Service from kubernetes.yml
[INFO] Updated Service: target/fabric8/applyJson/default/service-webdemo.json
[INFO] Using namespace: default
[INFO] Updating Deployment from kubernetes.yml
[INFO] Updated Deployment: target/fabric8/applyJson/default/deployment-webdemo.json
[INFO] F8: HINT: Use the command kubectl get pods -w
to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.804 s
[INFO] Finished at: 2019-07-07T21:32:26+08:00
[INFO] ------------------------------------------------------------------------
- 查看service和pod,确认一切正常:
[root@minikube webdemo]# kubectl get serv