Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 无法使用jkube插件在MicroK8s群集上部署Spring Boot Helloworld应用程序_Spring Boot_Docker_Kubernetes_Microk8s_Jkube - Fatal编程技术网

Spring boot 无法使用jkube插件在MicroK8s群集上部署Spring Boot Helloworld应用程序

Spring boot 无法使用jkube插件在MicroK8s群集上部署Spring Boot Helloworld应用程序,spring-boot,docker,kubernetes,microk8s,jkube,Spring Boot,Docker,Kubernetes,Microk8s,Jkube,我有一个非常简单的springbootHelloworld应用程序,它显示Helloworld消息 我想在我的Ubuntu节点上部署该应用程序,该节点安装了MicroK8s 接下来的步骤: git克隆项目\u repo\u url\u此处 使用构建映像。/mvnw k8s:Build 使用./mvnw k8s:resource应用资源 使用部署应用程序。/mvnw k8s:Deploy 我可以使用/mvnw k8s:build命令构建该映像,也可以使用docker images命令查看映像,但无

我有一个非常简单的
springboot
Helloworld应用程序,它显示
HelloworldREST
API
编码>消息

我想在我的
Ubuntu
节点上部署该应用程序,该节点安装了
MicroK8s

接下来的步骤:

  • git克隆项目\u repo\u url\u此处
  • 使用构建映像。/mvnw k8s:Build
  • 使用./mvnw k8s:resource应用资源
  • 使用部署应用程序。/mvnw k8s:Deploy
  • 我可以使用
    /mvnw k8s:build
    命令构建该映像,也可以使用
    docker images
    命令查看映像,但无法使用
    /mvnw k8s:resource
    /mvnw k8s:deploy
    命令将其部署到
    MicroK8s
    集群上

    pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.3.3.RELEASE</version>
            <relativePath /> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.example</groupId>
        <artifactId>helloworld</artifactId>
        <version>0.0.2-SNAPSHOT</version>
        <name>helloworld</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>11</java.version>
            <spring-boot.build-image.imageName>chandeln/${project.artifactId}:${project.version}</spring-boot.build-image.imageName>
            <jkube.generator.name>${spring-boot.build-image.imageName}</jkube.generator.name>
            <docker.skip.tag>true</docker.skip.tag>
            <jkube.enricher.jkube-service.type>NodePort</jkube.enricher.jkube-service.type>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.jkube</groupId>
                    <artifactId>kubernetes-maven-plugin</artifactId>
                    <version>1.0.2</version>
                </plugin>
            </plugins>
        </build>
    
    </project>
    
    NAME                            READY   STATUS    RESTARTS   AGE
    pod/microbot-5f5499d479-t2cdz   1/1     Running   1          31d
    pod/microbot-5f5499d479-r6d57   1/1     Running   3          31d
    pod/microbot-5f5499d479-7zztm   1/1     Running   3          31d
    pod/nginx-6799fc88d8-9sf5j      1/1     Running   5          31d
    
    NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
    service/kubernetes         ClusterIP   10.152.183.1     <none>        443/TCP        31d
    service/microbot-service   NodePort    10.152.183.184   <none>        81:31587/TCP   31d
    
    NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/microbot   3/3     3            3           31d
    deployment.apps/nginx      1/1     1            1           31d
    
    NAME                                  DESIRED   CURRENT   READY   AGE
    replicaset.apps/microbot-5f5499d479   3         3         3       31d
    replicaset.apps/nginx-6799fc88d8      1         1         1       31d
    
    在我的
    Ubuntu
    机器上安装了
    MicroK8s

    microk8s状态--等待就绪

    microk8s is running
    high-availability: no
      datastore master nodes: <my-ubuntu-machine-public-ip>:19001
      datastore standby nodes: none
    addons:
      enabled:
        dashboard            # The Kubernetes dashboard
        dns                  # CoreDNS
        ha-cluster           # Configure high availability on the current node
        ingress              # Ingress controller for external access
        metrics-server       # K8s Metrics Server for API access to service metrics
      disabled:
        ambassador           # Ambassador API Gateway and Ingress
        cilium               # SDN, fast with full network policy
        fluentd              # Elasticsearch-Fluentd-Kibana logging and monitoring
        gpu                  # Automatic enablement of Nvidia CUDA
        helm                 # Helm 2 - the package manager for Kubernetes
        helm3                # Helm 3 - Kubernetes package manager
        host-access          # Allow Pods connecting to Host services smoothly
        istio                # Core Istio service mesh services
        jaeger               # Kubernetes Jaeger operator with its simple config
        knative              # The Knative framework on Kubernetes.
        kubeflow             # Kubeflow for easy ML deployments
        linkerd              # Linkerd is a service mesh for Kubernetes and other frameworks
        metallb              # Loadbalancer for your Kubernetes cluster
        multus               # Multus CNI enables attaching multiple network interfaces to pods
        prometheus           # Prometheus operator for monitoring and logging
        rbac                 # Role-Based Access Control for authorisation
        registry             # Private image registry exposed on localhost:32000
        storage              # Storage class; allocates storage from host directory
    
     .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.3.3.RELEASE)
    
    2020-12-24 03:18:13.492  INFO 1828768 --- [           main] c.e.h.HelloworldApplicationTests         : Starting HelloworldApplicationTests on tools-server.kanaaritech.com with PID 1828768 (started by admin in /home/admin/apps/helloworld)
    2020-12-24 03:18:13.494  INFO 1828768 --- [           main] c.e.h.HelloworldApplicationTests         : The following profiles are active: tools
    2020-12-24 03:18:24.499  INFO 1828768 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
    2020-12-24 03:18:27.959  INFO 1828768 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
    2020-12-24 03:18:28.684  INFO 1828768 --- [           main] c.e.h.HelloworldApplicationTests         : Started HelloworldApplicationTests in 15.912 seconds (JVM running for 18.923)
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 20.012 s - in com.example.helloworld.HelloworldApplicationTests
    2020-12-24 03:18:31.927  INFO 1828768 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
    [INFO]
    [INFO] Results:
    [INFO]
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    [INFO]
    [INFO]
    [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ helloworld ---
    [INFO] Building jar: /home/admin/apps/helloworld/target/helloworld-0.0.2-SNAPSHOT.jar
    [INFO]
    [INFO] --- spring-boot-maven-plugin:2.3.3.RELEASE:repackage (repackage) @ helloworld ---
    [INFO] Replacing main artifact with repackaged archive
    [INFO]
    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ helloworld ---
    [INFO] Installing /home/admin/apps/helloworld/target/helloworld-0.0.2-SNAPSHOT.jar to /home/admin/.m2/repository/com/example/helloworld/0.0.2-SNAPSHOT/helloworld-0.0.2-SNAPSHOT.jar
    [INFO] Installing /home/admin/apps/helloworld/pom.xml to /home/admin/.m2/repository/com/example/helloworld/0.0.2-SNAPSHOT/helloworld-0.0.2-SNAPSHOT.pom
    [INFO]
    [INFO] <<< kubernetes-maven-plugin:1.0.2:deploy (default-cli) < install @ helloworld <<<
    [INFO]
    [INFO]
    [INFO] --- kubernetes-maven-plugin:1.0.2:deploy (default-cli) @ helloworld ---
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] k8s: Cannot access cluster for detecting mode: Unknown host kubernetes.default.svc: Name or service not known
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] k8s: Cannot access cluster for detecting mode: Unknown host kubernetes.default.svc
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [ERROR] k8s: Could not connect to kubernetes cluster!
    [ERROR] k8s: Connection error: %s: java.net.UnknownHostException: kubernetes.default.svc
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  38.670 s
    [INFO] Finished at: 2020-12-24T03:18:42Z
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.2:deploy (default-cli) on project helloworld: Execution default-cli of goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.2:deploy failed: Could not connect to kubernetes cluster. Have you started a cluster via `mvn jkube:cluster-start` or connected to a remote cluster via `kubectl`? Error: java.net.UnknownHostException: kubernetes.default.svc: An error has occurred. Unknown host kubernetes.default.svc -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
    
    kubectl全力以赴

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.3.3.RELEASE</version>
            <relativePath /> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.example</groupId>
        <artifactId>helloworld</artifactId>
        <version>0.0.2-SNAPSHOT</version>
        <name>helloworld</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>11</java.version>
            <spring-boot.build-image.imageName>chandeln/${project.artifactId}:${project.version}</spring-boot.build-image.imageName>
            <jkube.generator.name>${spring-boot.build-image.imageName}</jkube.generator.name>
            <docker.skip.tag>true</docker.skip.tag>
            <jkube.enricher.jkube-service.type>NodePort</jkube.enricher.jkube-service.type>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.jkube</groupId>
                    <artifactId>kubernetes-maven-plugin</artifactId>
                    <version>1.0.2</version>
                </plugin>
            </plugins>
        </build>
    
    </project>
    
    NAME                            READY   STATUS    RESTARTS   AGE
    pod/microbot-5f5499d479-t2cdz   1/1     Running   1          31d
    pod/microbot-5f5499d479-r6d57   1/1     Running   3          31d
    pod/microbot-5f5499d479-7zztm   1/1     Running   3          31d
    pod/nginx-6799fc88d8-9sf5j      1/1     Running   5          31d
    
    NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
    service/kubernetes         ClusterIP   10.152.183.1     <none>        443/TCP        31d
    service/microbot-service   NodePort    10.152.183.184   <none>        81:31587/TCP   31d
    
    NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/microbot   3/3     3            3           31d
    deployment.apps/nginx      1/1     1            1           31d
    
    NAME                                  DESIRED   CURRENT   READY   AGE
    replicaset.apps/microbot-5f5499d479   3         3         3       31d
    replicaset.apps/nginx-6799fc88d8      1         1         1       31d
    
    /mvnw k8s:资源

    [INFO] Scanning for projects...
    [INFO]
    [INFO] -----------------------< com.example:helloworld >-----------------------
    [INFO] Building helloworld 0.0.2-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- kubernetes-maven-plugin:1.0.2:resource (default-cli) @ helloworld ---
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] k8s: Cannot access cluster for detecting mode: Unknown host kubernetes.default.svc: Name or service not known
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [INFO] k8s: Running generator spring-boot
    [INFO] k8s: spring-boot: Using Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.8 as base / builder
    [INFO] k8s: Using resource templates from /home/admin/apps/helloworld/src/main/jkube
    [INFO] k8s: jkube-controller: Adding a default Deployment
    [INFO] k8s: jkube-service: Adding a default service 'helloworld' with ports [8080]
    [INFO] k8s: jkube-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
    [INFO] k8s: jkube-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
    [INFO] k8s: jkube-revision-history: Adding revision history limit to 2
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  10.701 s
    [INFO] Finished at: 2020-12-24T03:01:08Z
    [INFO] ------------------------------------------------------------------------
    
    [INFO]正在扫描项目。。。
    [信息]
    [信息]-------------------------------------------------
    [信息]正在构建helloworld 0.0.2-SNAPSHOT
    [信息]------------------------------------[jar]---------------------------------
    [信息]
    [信息]---kubernetes maven插件:1.0.2:resource(默认cli)@helloworld---
    [警告]从以下位置读取服务帐户令牌时出错:[/var/run/secrets/kubernetes.io/servicecomport/token]。忽略。
    [警告]k8s:无法为检测模式访问群集:未知主机kubernetes.default.svc:名称或服务未知
    [警告]从以下位置读取服务帐户令牌时出错:[/var/run/secrets/kubernetes.io/servicecomport/token]。忽略。
    [信息]k8s:正在运行的发电机弹簧护套
    [信息]k8s:spring引导:使用Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.8作为基本/构建器
    [INFO]k8s:使用/home/admin/apps/helloworld/src/main/jkube中的资源模板
    [信息]k8s:jkube控制器:添加默认部署
    [信息]k8s:jkube服务:添加带有端口[8080]的默认服务“helloworld”
    [信息]k8s:jkube healthcheck spring引导:在端口8080上添加就绪探测,路径='/actuator/health',scheme='HTTP',初始延迟10秒
    [INFO]k8s:jkube healthcheck spring引导:在端口8080上添加活动探测器,路径='/actuator/health',scheme='HTTP',初始延迟180秒
    [信息]k8s:jkube修订历史:将修订历史限制添加到2
    [信息]------------------------------------------------------------------------
    [信息]建立成功
    [信息]------------------------------------------------------------------------
    [信息]总时间:10.701秒
    [信息]完成时间:2020-12-24T03:01:08Z
    [信息]------------------------------------------------------------------------
    
    /mvnw k8s:部署

    microk8s is running
    high-availability: no
      datastore master nodes: <my-ubuntu-machine-public-ip>:19001
      datastore standby nodes: none
    addons:
      enabled:
        dashboard            # The Kubernetes dashboard
        dns                  # CoreDNS
        ha-cluster           # Configure high availability on the current node
        ingress              # Ingress controller for external access
        metrics-server       # K8s Metrics Server for API access to service metrics
      disabled:
        ambassador           # Ambassador API Gateway and Ingress
        cilium               # SDN, fast with full network policy
        fluentd              # Elasticsearch-Fluentd-Kibana logging and monitoring
        gpu                  # Automatic enablement of Nvidia CUDA
        helm                 # Helm 2 - the package manager for Kubernetes
        helm3                # Helm 3 - Kubernetes package manager
        host-access          # Allow Pods connecting to Host services smoothly
        istio                # Core Istio service mesh services
        jaeger               # Kubernetes Jaeger operator with its simple config
        knative              # The Knative framework on Kubernetes.
        kubeflow             # Kubeflow for easy ML deployments
        linkerd              # Linkerd is a service mesh for Kubernetes and other frameworks
        metallb              # Loadbalancer for your Kubernetes cluster
        multus               # Multus CNI enables attaching multiple network interfaces to pods
        prometheus           # Prometheus operator for monitoring and logging
        rbac                 # Role-Based Access Control for authorisation
        registry             # Private image registry exposed on localhost:32000
        storage              # Storage class; allocates storage from host directory
    
     .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.3.3.RELEASE)
    
    2020-12-24 03:18:13.492  INFO 1828768 --- [           main] c.e.h.HelloworldApplicationTests         : Starting HelloworldApplicationTests on tools-server.kanaaritech.com with PID 1828768 (started by admin in /home/admin/apps/helloworld)
    2020-12-24 03:18:13.494  INFO 1828768 --- [           main] c.e.h.HelloworldApplicationTests         : The following profiles are active: tools
    2020-12-24 03:18:24.499  INFO 1828768 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
    2020-12-24 03:18:27.959  INFO 1828768 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
    2020-12-24 03:18:28.684  INFO 1828768 --- [           main] c.e.h.HelloworldApplicationTests         : Started HelloworldApplicationTests in 15.912 seconds (JVM running for 18.923)
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 20.012 s - in com.example.helloworld.HelloworldApplicationTests
    2020-12-24 03:18:31.927  INFO 1828768 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
    [INFO]
    [INFO] Results:
    [INFO]
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    [INFO]
    [INFO]
    [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ helloworld ---
    [INFO] Building jar: /home/admin/apps/helloworld/target/helloworld-0.0.2-SNAPSHOT.jar
    [INFO]
    [INFO] --- spring-boot-maven-plugin:2.3.3.RELEASE:repackage (repackage) @ helloworld ---
    [INFO] Replacing main artifact with repackaged archive
    [INFO]
    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ helloworld ---
    [INFO] Installing /home/admin/apps/helloworld/target/helloworld-0.0.2-SNAPSHOT.jar to /home/admin/.m2/repository/com/example/helloworld/0.0.2-SNAPSHOT/helloworld-0.0.2-SNAPSHOT.jar
    [INFO] Installing /home/admin/apps/helloworld/pom.xml to /home/admin/.m2/repository/com/example/helloworld/0.0.2-SNAPSHOT/helloworld-0.0.2-SNAPSHOT.pom
    [INFO]
    [INFO] <<< kubernetes-maven-plugin:1.0.2:deploy (default-cli) < install @ helloworld <<<
    [INFO]
    [INFO]
    [INFO] --- kubernetes-maven-plugin:1.0.2:deploy (default-cli) @ helloworld ---
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] k8s: Cannot access cluster for detecting mode: Unknown host kubernetes.default.svc: Name or service not known
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] k8s: Cannot access cluster for detecting mode: Unknown host kubernetes.default.svc
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
    [ERROR] k8s: Could not connect to kubernetes cluster!
    [ERROR] k8s: Connection error: %s: java.net.UnknownHostException: kubernetes.default.svc
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  38.670 s
    [INFO] Finished at: 2020-12-24T03:18:42Z
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.2:deploy (default-cli) on project helloworld: Execution default-cli of goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.2:deploy failed: Could not connect to kubernetes cluster. Have you started a cluster via `mvn jkube:cluster-start` or connected to a remote cluster via `kubectl`? Error: java.net.UnknownHostException: kubernetes.default.svc: An error has occurred. Unknown host kubernetes.default.svc -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
    
    。\uuuuuuuuuuuu_
    /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    ::弹簧靴::(v2.3.3.版本)
    2020-12-24 03:18:13.492信息1828768---[main]c.e.h.HelloworldApplicationTests:在tools-server.kanaaritech.com上以PID 1828768启动HelloworldApplicationTests(由管理员在/home/admin/apps/helloworld中启动)
    2020-12-24 03:18:13.494信息1828768---[main]c.e.h.HelloworldApplicationTests:以下配置文件处于活动状态:工具
    2020-12-24 03:18:24.499信息1828768---[main]o.s.s.concurrent.ThreadPoolTaskExecutor:初始化ExecutorService'applicationTaskExecutor'
    2020-12-24 03:18:27.959信息1828768---[main]o.s.b.a.e.web.EndpointLinksResolver:在基本路径“/执行器”下暴露两个端点
    2020-12-24 03:18:28.684信息1828768---[main]c.e.h.HelloworldApplicationTests:在15.912秒内启动HelloworldApplicationTests(JVM运行18.923)
    [信息]测试运行:1,失败:0,错误:0,跳过:0,运行时间:20.012秒-在com.example.helloworld.HelloworldApplicationTests中
    2020-12-24 03:18:31.927信息1828768---[extShutdownHook]o.s.s.concurrent.ThreadPoolTaskExecutor:正在关闭ExecutorService'applicationTaskExecutor'
    [信息]
    [信息]结果:
    [信息]
    [信息]测试运行:1,失败:0,错误:0,跳过:0
    [信息]
    [信息]
    [信息]---maven jar插件:3.2.0:jar(默认jar)@helloworld---
    [信息]构建jar:/home/admin/apps/helloworld/target/helloworld-0.0.2-SNAPSHOT.jar
    [信息]
    [信息]---spring boot maven插件:2.3.3.版本:重新打包(重新打包)@helloworld---
    [信息]用重新打包的归档文件替换主工件
    [信息]
    [信息]---maven安装插件:2.5.2:install(默认安装)@helloworld---
    [信息]安装/home/admin/apps/helloworld/target/helloworld-0.0.2-SNAPSHOT.jar到/home/admin/.m2/repository/com/example/helloworld/0.0.2-SNAPSHOT/helloworld-0.0.2-SNAPSHOT.jar
    [信息]将/home/admin/apps/helloworld/pom.xml安装到/home/admin/.m2/repository/com/example/helloworld/0.0.2-SNAPSHOT/helloworld-0.0.2-SNAPSHOT.pom
    [信息]
    
    [INFO]MicroK8s有自己的
    kubectl
    打包版本,默认情况下可通过MicroK8s访问,包括其配置

    microk8s kubectl

    为了让JKube
    了解您的MicroK8s集群,您需要导出配置
    MicroK8s配置
    ,并将其放在kubeconfig文件
    ~/.kube/config

    cd $HOME
    mkdir .kube
    cd .kube
    microk8s config > config
    

    参考资料:

    MicroK8s有自己的
    kubectl
    打包版本,默认情况下可通过MicroK8s访问,包括其配置

    microk8s kubectl

    为了