{"id":15777318,"url":"https://github.com/v5tech/k8s-example","last_synced_at":"2025-03-14T08:30:28.075Z","repository":{"id":149461733,"uuid":"261999348","full_name":"v5tech/k8s-example","owner":"v5tech","description":"Spring Boot整合Kubernetes","archived":false,"fork":false,"pushed_at":"2022-06-21T14:36:44.000Z","size":1603,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-11T18:01:40.294Z","etag":null,"topics":["k8s","kt-connect","kubernetes","kustomize","kustomize-example","skaffold","skaffold-example","spring-boot-2"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/v5tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-05-07T08:53:40.000Z","updated_at":"2022-06-21T14:36:47.000Z","dependencies_parsed_at":"2023-05-22T02:15:42.812Z","dependency_job_id":null,"html_url":"https://github.com/v5tech/k8s-example","commit_stats":null,"previous_names":["v5tech/k8s-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v5tech%2Fk8s-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v5tech%2Fk8s-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v5tech%2Fk8s-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v5tech%2Fk8s-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v5tech","download_url":"https://codeload.github.com/v5tech/k8s-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221447335,"owners_count":16823178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k8s","kt-connect","kubernetes","kustomize","kustomize-example","skaffold","skaffold-example","spring-boot-2"],"created_at":"2024-10-04T18:00:23.270Z","updated_at":"2024-10-25T18:04:50.626Z","avatar_url":"https://github.com/v5tech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# k8s-example\n\n### 使用`spring-boot-maven-plugin`构建\n\n升级spring boot 版本为2.3.x，执行`spring-boot:build-image`命令即可。\n\n```bash\n$  mvn spring-boot:build-image\n  [INFO] Scanning for projects...\n  [INFO] \n  [INFO] -----------------------\u003c net.ameizi:k8s-example \u003e-----------------------\n  [INFO] Building k8s-example 1.0.0\n  [INFO] --------------------------------[ jar ]---------------------------------\n  [INFO] \n  [INFO] \u003e\u003e\u003e spring-boot-maven-plugin:2.3.0.BUILD-SNAPSHOT:build-image (default-cli) \u003e package @ k8s-example \u003e\u003e\u003e\n  [INFO] \n  [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ k8s-example ---\n  [INFO] Using 'UTF-8' encoding to copy filtered resources.\n  [INFO] Copying 1 resource\n  [INFO] Copying 0 resource\n  [INFO] \n  [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ k8s-example ---\n  [INFO] Changes detected - recompiling the module!\n  [INFO] Compiling 1 source file to /Users/amz/develop/workspace/k8s-example/target/classes\n  [INFO] \n  [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ k8s-example ---\n  [INFO] Using 'UTF-8' encoding to copy filtered resources.\n  [INFO] skip non existing resourceDirectory /Users/amz/develop/workspace/k8s-example/src/test/resources\n  [INFO] \n  [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ k8s-example ---\n  [INFO] Changes detected - recompiling the module!\n  [INFO] Compiling 1 source file to /Users/amz/develop/workspace/k8s-example/target/test-classes\n  [INFO] \n  [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ k8s-example ---\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/apache/maven/surefire/surefire-providers/2.22.2/surefire-providers-2.22.2.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apache/maven/surefire/surefire-providers/2.22.2/surefire-providers-2.22.2.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.22.2/surefire-providers-2.22.2.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.22.2/surefire-providers-2.22.2.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.pom\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.pom\n  Downloading from central: https://repo.maven.apache.org/maven2/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.pom\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.pom (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.jar\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.jar\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.jar\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.jar\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar\n  Downloading from central: https://repo.maven.apache.org/maven2/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar (0 B at 0 B/s)\n  Downloading from spring-milestones: https://repo.spring.io/milestone/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar\n  Downloading from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.jar\n  Downloading from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar\n  Downloading from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.jar\n  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.jar (0 B at 0 B/s)\n  Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar\n  Downloading from central: https://repo.maven.apache.org/maven2/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar (0 B at 0 B/s)\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar (0 B at 0 B/s)\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar (0 B at 0 B/s)\n  Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.jar (0 B at 0 B/s)\n  [INFO] \n  [INFO] -------------------------------------------------------\n  [INFO]  T E S T S\n  [INFO] -------------------------------------------------------\n  [INFO] Running net.ameizi.k8s.example.K8sExampleApplicationTests\n  14:26:46.188 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]\n  14:26:46.206 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]\n  14:26:46.250 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [net.ameizi.k8s.example.K8sExampleApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]\n  14:26:46.267 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [net.ameizi.k8s.example.K8sExampleApplicationTests], using SpringBootContextLoader\n  14:26:46.277 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: class path resource [net/ameizi/k8s/example/K8sExampleApplicationTests-context.xml] does not exist\n  14:26:46.278 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: class path resource [net/ameizi/k8s/example/K8sExampleApplicationTestsContext.groovy] does not exist\n  14:26:46.278 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.\n  14:26:46.279 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: K8sExampleApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.\n  14:26:46.354 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [net.ameizi.k8s.example.K8sExampleApplicationTests]\n  14:26:46.457 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/Users/amz/develop/workspace/k8s-example/target/classes/net/ameizi/k8s/example/K8sExampleApplication.class]\n  14:26:46.458 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration net.ameizi.k8s.example.K8sExampleApplication for test class net.ameizi.k8s.example.K8sExampleApplicationTests\n  14:26:46.580 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [net.ameizi.k8s.example.K8sExampleApplicationTests]: using defaults.\n  14:26:46.582 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]\n  14:26:46.603 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]\n  14:26:46.604 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]\n  14:26:46.605 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1da2cb77, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@48f278eb, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@2f217633, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@a530d0a, org.springframework.test.context.support.DirtiesContextTestExecutionListener@1a18644, org.springframework.test.context.event.EventPublishingTestExecutionListener@5acf93bb, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@7e7be63f, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@6cd28fa7, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@614ca7df, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@4738a206, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@66d3eec0]\n  14:26:46.609 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@741a8937 testClass = K8sExampleApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@306e95ec testClass = K8sExampleApplicationTests, locations = '{}', classes = '{class net.ameizi.k8s.example.K8sExampleApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@2ddc8ecb, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@33afa13b, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@5dd6264, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@7c0c77c7, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -\u003e true]], class annotated with @DirtiesContext [false] with mode [null].\n  14:26:46.654 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}\n  \n    .   ____          _            __ _ _\n   /\\\\ / ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n  ( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\n   \\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n    '  |____| .__|_| |_|_| |_\\__, | / / / /\n   =========|_|==============|___/=/_/_/_/\n   :: Spring Boot ::  (v2.3.0.BUILD-SNAPSHOT)\n  \n  2020-05-07 14:26:47.064  INFO 44321 --- [           main] n.a.k.e.K8sExampleApplicationTests       : Starting K8sExampleApplicationTests on swfeng.local with PID 44321 (started by amz in /Users/amz/develop/workspace/k8s-example)\n  2020-05-07 14:26:47.066  INFO 44321 --- [           main] n.a.k.e.K8sExampleApplicationTests       : No active profile set, falling back to default profiles: default\n  2020-05-07 14:26:48.913  INFO 44321 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'\n  2020-05-07 14:26:49.506  INFO 44321 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'\n  2020-05-07 14:26:49.595  INFO 44321 --- [           main] n.a.k.e.K8sExampleApplicationTests       : Started K8sExampleApplicationTests in 2.92 seconds (JVM running for 4.057)\n  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.872 s - in net.ameizi.k8s.example.K8sExampleApplicationTests\n  2020-05-07 14:26:49.969  INFO 44321 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'\n  [INFO] \n  [INFO] Results:\n  [INFO] \n  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n  [INFO] \n  [INFO] \n  [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ k8s-example ---\n  [INFO] Building jar: /Users/amz/develop/workspace/k8s-example/target/k8s-example-1.0.0.jar\n  [INFO] \n  [INFO] --- spring-boot-maven-plugin:2.3.0.BUILD-SNAPSHOT:repackage (repackage) @ k8s-example ---\n  [INFO] Replacing main artifact with repackaged archive\n  [INFO] \n  [INFO] --- jib-maven-plugin:2.2.0:build (default) @ k8s-example ---\n  [INFO] \n  [INFO] Containerizing application to registry.hub.docker.com/aimeizi/k8s-example...\n  [WARNING] Base image 'openjdk:8-jdk-alpine' does not use a specific image digest - build may not be reproducible\n  [INFO] Using credentials from Docker config (/Users/amz/.docker/config.json) for registry.hub.docker.com/aimeizi/k8s-example\n  [INFO] The base image requires auth. Trying again for openjdk:8-jdk-alpine...\n  [WARNING] The credential helper (docker-credential-desktop) has nothing for server URL: registry-1.docker.ioNG] \n  \n  Got output:\n  \n  credentials not found in native keychain\n  \n  [INFO] Using credentials from Docker config (/Users/amz/.docker/config.json) for openjdk:8-jdk-alpine\n  [INFO] Using base image with digest: sha256:44b3cea369c947527e266275cee85c71a81f20fc5076f6ebb5a13f19015dce71 \n  [INFO] \n  [INFO] Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, net.ameizi.k8s.example.K8sExampleApplication]\n  [INFO] \n  [INFO] Built and pushed image as registry.hub.docker.com/aimeizi/k8s-example\n  [INFO] Executing tasks:\n  [INFO] [===========================   ] 88.9% complete\n  [INFO] \u003e launching layer pushers\n  [INFO] \n  [INFO] \n  [INFO] \u003c\u003c\u003c spring-boot-maven-plugin:2.3.0.BUILD-SNAPSHOT:build-image (default-cli) \u003c package @ k8s-example \u003c\u003c\u003c\n  [INFO] \n  [INFO] \n  [INFO] --- spring-boot-maven-plugin:2.3.0.BUILD-SNAPSHOT:build-image (default-cli) @ k8s-example ---\n  [INFO] Building image 'docker.io/library/k8s-example:1.0.0'\n  [INFO] \n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 0%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 2%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 2%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 2%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 3%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 3%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 4%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 4%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 6%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 7%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 7%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 8%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 8%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 10%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 11%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 11%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 12%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 12%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 12%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 13%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 13%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 13%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 14%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 15%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 16%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 20%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 20%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 21%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 21%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 22%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 22%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 23%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 23%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 23%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 24%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 24%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 24%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 25%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 25%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 25%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 26%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 26%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 27%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 27%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 27%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 28%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 28%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 29%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 30%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 30%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 31%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 31%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 31%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 32%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 32%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 32%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 32%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 32%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 33%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 33%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 33%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 33%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 33%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 34%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 34%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 34%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 34%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 34%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 35%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 35%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 35%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 36%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 36%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 37%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 37%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 37%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 38%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 39%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 48%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 52%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 54%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 59%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 63%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 65%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 67%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 69%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 69%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 69%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 70%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 72%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 72%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 73%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 73%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 73%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 74%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 74%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 74%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 75%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 77%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 79%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 79%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 80%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 80%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 81%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 81%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 81%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 81%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 83%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 87%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 89%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 89%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 90%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 90%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 90%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 90%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 91%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 91%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 91%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 91%\n  [INFO]  \u003e Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' 100%\n  [INFO]  \u003e Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:1bb775a178ed4c54246ab71f323d2a5af0e4b70c83b0dc84f974694b0221d636'\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 3%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 21%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 32%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 35%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 37%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 37%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 38%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 38%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 38%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 39%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 39%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 39%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 40%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 40%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 40%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 40%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 40%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 41%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 41%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 41%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 42%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 42%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 46%\n  [INFO]  \u003e Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' 100%\n  [INFO]  \u003e Pulled run image 'gcr.io/paketo-buildpacks/run@sha256:d70bf0fe11d84277997c4a7da94b2867a90d6c0f55add4e19b7c565d5087206f'\n  [INFO]  \u003e Executing lifecycle version v0.7.4\n  [INFO]  \u003e Using build cache volume 'pack-cache-55330c9f9824.build'\n  [INFO] \n  [INFO]  \u003e Running detector\n  [INFO]     [detector]    5 of 15 buildpacks participating\n  [INFO]     [detector]    paketo-buildpacks/bellsoft-liberica 2.5.0\n  [INFO]     [detector]    paketo-buildpacks/executable-jar    1.2.2\n  [INFO]     [detector]    paketo-buildpacks/apache-tomcat     1.1.2\n  [INFO]     [detector]    paketo-buildpacks/dist-zip          1.2.2\n  [INFO]     [detector]    paketo-buildpacks/spring-boot       1.5.2\n  [INFO] \n  [INFO]  \u003e Running analyzer\n  [INFO]     [analyzer]    Previous image with name \"docker.io/library/k8s-example:1.0.0\" not found\n  [INFO] \n  [INFO]  \u003e Running restorer\n  [INFO] \n  [INFO]  \u003e Running builder\n  [INFO]     [builder]     \n  [INFO]     [builder]     Paketo BellSoft Liberica Buildpack 2.5.0\n  [INFO]     [builder]         Set $BP_JAVA_VERSION to configure the Java version. Default 11.*.\n  [INFO]     [builder]         Set $BPL_HEAD_ROOM to configure the headroom in memory calculation. Default 0.\n  [INFO]     [builder]         Set $BPL_LOADED_CLASS_COUNT to configure the number of loaded classes in memory calculation. Default 35% of classes.\n  [INFO]     [builder]         Set $BPL_THREAD_COUNT to configure the number of threads in memory calculation. Default 250.\n  [INFO]     [builder]       BellSoft Liberica JRE 8.0.252: Contributing to layer\n  [INFO]     [builder]         Downloading from https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz\n  [INFO]     [builder]         Verifying checksum\n  [INFO]     [builder]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre\n  [INFO]     [builder]         Writing env.launch/JAVA_HOME.override\n  [INFO]     [builder]         Writing env.launch/MALLOC_ARENA_MAX.override\n  [INFO]     [builder]         Writing profile.d/active-processor-count.sh\n  [INFO]     [builder]       Memory Calculator 4.0.0: Contributing to layer\n  [INFO]     [builder]         Downloading from https://github.com/cloudfoundry/java-buildpack-memory-calculator/releases/download/v4.0.0/memory-calculator-4.0.0.tgz\n  [INFO]     [builder]         Verifying checksum\n  [INFO]     [builder]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/memory-calculator\n  [INFO]     [builder]         Writing profile.d/memory-calculator.sh\n  [INFO]     [builder]       Class Counter: Contributing to layer\n  [INFO]     [builder]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/class-counter\n  [INFO]     [builder]       JVMKill Agent 1.16.0: Contributing to layer\n  [INFO]     [builder]         Downloading from https://github.com/cloudfoundry/jvmkill/releases/download/v1.16.0.RELEASE/jvmkill-1.16.0-RELEASE.so\n  [INFO]     [builder]         Verifying checksum\n  [INFO]     [builder]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/jvmkill\n  [INFO]     [builder]         Writing env.launch/JAVA_OPTS.append\n  [INFO]     [builder]       Link-Local DNS: Contributing to layer\n  [INFO]     [builder]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/link-local-dns\n  [INFO]     [builder]         Writing profile.d/link-local-dns.sh\n  [INFO]     [builder]       Java Security Properties: Contributing to layer\n  [INFO]     [builder]         Writing env.launch/JAVA_OPTS.append\n  [INFO]     [builder]         Writing env.launch/JAVA_SECURITY_PROPERTIES.override\n  [INFO]     [builder]       Security Providers Configurer: Contributing to layer\n  [INFO]     [builder]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/security-providers-configurer\n  [INFO]     [builder]         Writing profile.d/security-providers-classpath.sh\n  [INFO]     [builder]         Writing profile.d/security-providers-configurer.sh\n  [INFO]     [builder]       OpenSSL Security Provider 1.0.2: Contributing to layer\n  [INFO]     [builder]         Downloading from https://jitpack.io/com/github/paketo-buildpacks/openssl-security-provider/1.0.2/openssl-security-provider-1.0.2.jar\n  [INFO]     [builder]         Verifying checksum\n  [INFO]     [builder]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/openssl-security-provider\n  [INFO]     [builder]         Writing env.launch/SECURITY_PROVIDERS.append\n  [INFO]     [builder]         Writing env.launch/SECURITY_PROVIDERS_CLASSPATH\n  [INFO]     [builder]         Writing profile.d/openssl-security-provider.sh\n  [INFO]     [builder]     \n  [INFO]     [builder]     Paketo Executable JAR Buildpack 1.2.2\n  [INFO]     [builder]         Writing env/CLASSPATH\n  [INFO]     [builder]       Process types:\n  [INFO]     [builder]         executable-jar: java -cp \"${CLASSPATH}\" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher\n  [INFO]     [builder]         task:           java -cp \"${CLASSPATH}\" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher\n  [INFO]     [builder]         web:            java -cp \"${CLASSPATH}\" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher\n  [INFO]     [builder]     \n  [INFO]     [builder]     Paketo Spring Boot Buildpack 1.5.2\n  [INFO]     [builder]       Image labels:\n  [INFO]     [builder]         org.opencontainers.image.title\n  [INFO]     [builder]         org.opencontainers.image.version\n  [INFO]     [builder]         org.springframework.boot.spring-configuration-metadata.json\n  [INFO]     [builder]         org.springframework.boot.version\n  [INFO] \n  [INFO]  \u003e Running exporter\n  [INFO]     [exporter]    Adding layer 'launcher'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:class-counter'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:java-security-properties'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:jre'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:jvmkill'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:link-local-dns'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:memory-calculator'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:openssl-security-provider'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/bellsoft-liberica:security-providers-configurer'\n  [INFO]     [exporter]    Adding layer 'paketo-buildpacks/executable-jar:class-path'\n  [INFO]     [exporter]    Adding 1/1 app layer(s)\n  [INFO]     [exporter]    Adding layer 'config'\n  [INFO]     [exporter]    *** Images (39ca89c37d5b):\n  [INFO]     [exporter]          docker.io/library/k8s-example:1.0.0\n  [INFO]     [exporter]    Adding cache layer 'paketo-buildpacks/executable-jar:class-path'\n  [INFO] \n  [INFO] Successfully built image 'docker.io/library/k8s-example:1.0.0'\n  [INFO] \n  [INFO] ------------------------------------------------------------------------\n  [INFO] BUILD SUCCESS\n  [INFO] ------------------------------------------------------------------------\n  [INFO] Total time:  08:13 min\n  [INFO] Finished at: 2020-05-07T14:34:48+08:00\n  [INFO] ------------------------------------------------------------------------\n```\n根据日志输出发现构建好的镜像默认为`docker.io/library/k8s-example:1.0.0`。当然这个可以配置修改\n\n```xml\n\u003cplugin\u003e\n    \u003cgroupId\u003eorg.springframework.boot\u003c/groupId\u003e\n    \u003cartifactId\u003espring-boot-maven-plugin\u003c/artifactId\u003e\n    \u003cconfiguration\u003e\n        \u003cimage\u003e\n            \u003cname\u003ek8s-example:latest\u003c/name\u003e\n        \u003c/image\u003e\n    \u003c/configuration\u003e\n\u003c/plugin\u003e\n```\n\n### 使用`jib-maven-plugin`插件构建 `docker` 镜像\n\n```xml\n\u003cplugin\u003e\n    \u003cgroupId\u003ecom.google.cloud.tools\u003c/groupId\u003e\n    \u003cartifactId\u003ejib-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e2.2.0\u003c/version\u003e\n    \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cphase\u003epackage\u003c/phase\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ebuild\u003c/goal\u003e\n            \u003c/goals\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n    \u003cconfiguration\u003e\n        \u003cfrom\u003e\n            \u003cimage\u003eopenjdk:8-jdk-alpine\u003c/image\u003e\n        \u003c/from\u003e\n        \u003cto\u003e\n            \u003c!-- 坑!!!这里切记一定要设置 docker registry的完整地址，否则会被坑死，构建的时候会报授权错误，原因在于执行 mvn package 命令后会打包构建镜像并进行推送，因此要设置镜像仓库的地址，并且记得在命令行进行镜像仓库登录(docker login) --\u003e\n            \u003c!-- 此处构建不依赖docker daemon进程。说人话就是不需要启动docker服务 --\u003e\n            \u003cimage\u003eregistry.hub.docker.com/aimeizi/k8s-example:latest\u003c/image\u003e\n        \u003c/to\u003e\n        \u003ccontainer\u003e\n            \u003cmainClass\u003enet.ameizi.k8s.example.K8sExampleApplication\u003c/mainClass\u003e\n            \u003cports\u003e\n                \u003cport\u003e8080\u003c/port\u003e\n            \u003c/ports\u003e\n        \u003c/container\u003e\n    \u003c/configuration\u003e\n\u003c/plugin\u003e\n```\n\n执行构建\n\n[![asciicast](https://asciinema.org/a/Esgs9ePRSWqwYAGjD8CI84Lne.svg)](https://asciinema.org/a/Esgs9ePRSWqwYAGjD8CI84Lne)\n\n### Kubernetes\n\n导出 Deployment\n\n```bash\n$ mkdir k8s\n$ kubectl create deployment k8s-example --image registry.hub.docker.com/aimeizi/k8s-example:latest -o yaml --dry-run \u003e k8s/deployment.yaml\n```\n\n生成的deployment.yaml如下所示:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  creationTimestamp: null\n  labels:\n    app: k8s-example\n  name: k8s-example\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: k8s-example\n  strategy: {}\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: k8s-example\n    spec:\n      containers:\n      - image: registry.hub.docker.com/aimeizi/k8s-example:latest\n        name: k8s-example\n        resources: {}\nstatus: {}\n```\n\n导出 Service\n\n* ClusterIP方式\n\n```bash\n$ kubectl create service clusterip k8s-example --tcp 80:8080 -o yaml --dry-run \u003e k8s/service.yaml\n```\n其中`80:8080`，80为宿主机端口，8080为容器内应用端口\n\n生成的service.yaml如下所示:\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  creationTimestamp: null\n  labels:\n    app: k8s-example\n  name: k8s-example\nspec:\n  ports:\n  - name: 80-8080\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  selector:\n    app: k8s-example\n  type: ClusterIP # ClusterIP 需要 kubectl port-forward\nstatus:\n  loadBalancer: {}\n```\n\n应用和部署生成的Deployment、Service文件\n\n首先开启 watch 监听\n\n```bash\n$ watch -n 1 kubectl get all\nEvery 1.0s: kubectl get all                                     swfeng.local: Thu May  7 10:26:58 2020\n\nNAME                               READY   STATUS    RESTARTS   AGE\npod/k8s-example-664b9f68d4-jwxmb   1/1     Running   0          52s\n\n\nNAME                  TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)   AGE\nservice/k8s-example   ClusterIP   10.96.67.94   \u003cnone\u003e        80/TCP    52s\nservice/kubernetes    ClusterIP   10.96.0.1     \u003cnone\u003e        443/TCP   14d\n\n\nNAME                          READY   UP-TO-DATE   AVAILABLE   AGE\ndeployment.apps/k8s-example   1/1     1            1           52s\n```\n应用生成的yaml 文件\n\n```bash\n$ kubectl apply -f ./k8s\n  deployment.apps/k8s-example created\n  service/k8s-example created\n```\n\n访问和测试应用\n\n使用`kubectl port-forward`端口映射\n\n```bash\n$ kubectl port-forward service/k8s-example 8080:80\n  Forwarding from 127.0.0.1:8080 -\u003e 8080\n  Forwarding from [::1]:8080 -\u003e 8080\n```\n使用`kubectl port-forward`将`service/k8s-example`服务的 80 端口映射到宿主机的8080端口\n\n测试访问\n\n```bash\ncurl http://127.0.0.1:8080/hello\nhello,kubernetes!\n```\n\n* LoadBalancer方式\n\n注意:完成该实验时先清理资源。具体使用如下的命令\n\n```bash\n$ kubectl delete -f ./k8s\ndeployment.apps \"k8s-example\" deleted\nservice \"k8s-example\" deleted\n```\n\n备份并修改service.yaml文件，修改service.yaml文件中的`ClusterIp`为`LoadBalancer`，其修改后的文件内容为\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  creationTimestamp: null\n  labels:\n    app: k8s-example\n  name: k8s-example\nspec:\n  ports:\n  - name: 80-8080\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  selector:\n    app: k8s-example\n  type: LoadBalancer # LoadBalancer 不需要kubectl port-forward 直接用映射出来的 IP 和端口访问\nstatus:\n  loadBalancer: {}\n```\n\n应用修改后的文件\n\n```bash\n$ kubectl apply -f ./k8s\n```\n\n观察服务映射信息\n```bash\n$ watch -n 1 kubectl get all\nEvery 1.0s: kubectl get all                                     swfeng.local: Thu May  7 10:48:50 2020\n\nNAME                               READY   STATUS    RESTARTS   AGE\npod/k8s-example-664b9f68d4-wnf4s   1/1     Running   0          71s\n\n\nNAME                  TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE\nservice/k8s-example   LoadBalancer   10.100.43.70   localhost     80:31223/TCP   71s\nservice/kubernetes    ClusterIP      10.96.0.1      \u003cnone\u003e        443/TCP        14d\n```\n或执行如下的命令\n```bash\n$ kubectl get service k8s-example -w\n  NAME          TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE\n  k8s-example   LoadBalancer   10.100.43.70   localhost     80:31223/TCP   5m47s\n```\n根据日志输出发现`service/k8s-example`，已经做好了 IP、端口映射绑定。\n\n测试并访问应用\n\n```bash\n$ curl http://127.0.0.1/hello\n  hello,kubernetes!\n```\n\n### Skaffold\n\n检查版本信息\n```bash\n$ skaffold version\n  v1.9.0\n```\n\n生成skaffold.yaml文件\n```bash\n$ skaffold init --XXenableJibInit\n  apiVersion: skaffold/v2beta3\n  kind: Config\n  metadata:\n    name: k-s-example\n  build:\n    artifacts:\n    - image: registry.hub.docker.com/aimeizi/k8s-example\n      jib:\n        project: net.ameizi:k8s-example\n  deploy:\n    kubectl:\n      manifests:\n      - k8s/deployment.yaml\n      - k8s/service.yaml\n  \n  Do you want to write this configuration to skaffold.yaml? [y/n]: y\n  Configuration skaffold.yaml was written\n  You can now run [skaffold build] to build the artifacts\n  or [skaffold run] to build and deploy\n  or [skaffold dev] to enter development mode, with auto-redeploy\n```\n\n执行完上述操作后会在项目根目录生成一个`skaffold.yaml`文件，其内容为：\n\n```yaml\napiVersion: skaffold/v2beta3\nkind: Config\nmetadata:\n  name: k-s-example\nbuild:\n  artifacts:\n  - image: registry.hub.docker.com/aimeizi/k8s-example\n    jib:\n      project: net.ameizi:k8s-example\ndeploy:\n  kubectl:\n    manifests:\n    - k8s/deployment.yaml\n    - k8s/service.yaml\n```\n\n使用Skaffold部署应用\n\n```bash\n$ skaffold dev --port-forward\n  Listing files to watch...\n   - registry.hub.docker.com/aimeizi/k8s-example\n  Generating tags...\n   - registry.hub.docker.com/aimeizi/k8s-example -\u003e registry.hub.docker.com/aimeizi/k8s-example:latest\n  Some taggers failed. Rerun with -vdebug for errors.\n  Checking cache...\n   - registry.hub.docker.com/aimeizi/k8s-example: Not found. Building\n  Found [docker-desktop] context, using local docker daemon.\n  Building [registry.hub.docker.com/aimeizi/k8s-example]...\n  [INFO] Scanning for projects...\n  [INFO] \n  [INFO] -----------------------\u003c net.ameizi:k8s-example \u003e-----------------------\n  [INFO] Building k8s-example 1.0.0\n  [INFO] --------------------------------[ jar ]---------------------------------\n  [INFO] \n  [INFO] --- jib-maven-plugin:2.2.0:_skaffold-fail-if-jib-out-of-date (default-cli) @ k8s-example ---\n  [INFO] \n  [INFO] -----------------------\u003c net.ameizi:k8s-example \u003e-----------------------\n  [INFO] Building k8s-example 1.0.0\n  [INFO] --------------------------------[ jar ]---------------------------------\n  [INFO] \n  [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ k8s-example ---\n  [INFO] Using 'UTF-8' encoding to copy filtered resources.\n  [INFO] Copying 1 resource\n  [INFO] Copying 0 resource\n  [INFO] \n  [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ k8s-example ---\n  [INFO] Nothing to compile - all classes are up to date\n  [INFO] \n  [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ k8s-example ---\n  [INFO] Using 'UTF-8' encoding to copy filtered resources.\n  [INFO] skip non existing resourceDirectory /Users/amz/develop/workspace/k8s-example/src/test/resources\n  [INFO] \n  [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ k8s-example ---\n  [INFO] Changes detected - recompiling the module!\n  [INFO] Compiling 1 source file to /Users/amz/develop/workspace/k8s-example/target/test-classes\n  [INFO] \n  [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ k8s-example ---\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom (7.0 kB at 4.7 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-providers/2.22.2/surefire-providers-2.22.2.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-providers/2.22.2/surefire-providers-2.22.2.pom (2.5 kB at 5.5 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.pom (2.2 kB at 4.9 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.pom (1.2 kB at 2.6 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.pom (2.4 kB at 5.4 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.pom (2.0 kB at 4.5 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.pom\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.pom (1.7 kB at 3.7 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.jar\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.jar\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar (2.2 kB at 1.2 kB/s)\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-engine/1.3.1/junit-platform-engine-1.3.1.jar (135 kB at 75 kB/s)\n  Downloading from aliyun: https://maven.aliyun.com/repository/public/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-commons/1.3.1/junit-platform-commons-1.3.1.jar (78 kB at 38 kB/s)\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar (66 kB at 31 kB/s)\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar (95 kB at 45 kB/s)\n  Downloaded from aliyun: https://maven.aliyun.com/repository/public/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar (7.1 kB at 15 kB/s)\n  [INFO] \n  [INFO] -------------------------------------------------------\n  [INFO]  T E S T S\n  [INFO] -------------------------------------------------------\n  [INFO] Running net.ameizi.k8s.example.K8sExampleApplicationTests\n  11:09:31.561 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]\n  11:09:31.581 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]\n  11:09:31.624 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [net.ameizi.k8s.example.K8sExampleApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]\n  11:09:31.653 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [net.ameizi.k8s.example.K8sExampleApplicationTests], using SpringBootContextLoader\n  11:09:31.659 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: class path resource [net/ameizi/k8s/example/K8sExampleApplicationTests-context.xml] does not exist\n  11:09:31.660 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: class path resource [net/ameizi/k8s/example/K8sExampleApplicationTestsContext.groovy] does not exist\n  11:09:31.660 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.\n  11:09:31.662 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [net.ameizi.k8s.example.K8sExampleApplicationTests]: K8sExampleApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.\n  11:09:31.734 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [net.ameizi.k8s.example.K8sExampleApplicationTests]\n  11:09:31.858 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/Users/amz/develop/workspace/k8s-example/target/classes/net/ameizi/k8s/example/K8sExampleApplication.class]\n  11:09:31.859 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration net.ameizi.k8s.example.K8sExampleApplication for test class net.ameizi.k8s.example.K8sExampleApplicationTests\n  11:09:32.026 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [net.ameizi.k8s.example.K8sExampleApplicationTests]: using defaults.\n  11:09:32.027 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]\n  11:09:32.042 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]\n  11:09:32.042 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]\n  11:09:32.043 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@5ba3f27a, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@58d75e99, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@74751b3, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@741a8937, org.springframework.test.context.support.DirtiesContextTestExecutionListener@306e95ec, org.springframework.test.context.event.EventPublishingTestExecutionListener@52af26ee, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@6fd83fc1, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@4f2b503c, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@bae7dc0, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@209da20d, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@e15b7e8]\n  11:09:32.046 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@434a63ab testClass = K8sExampleApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@6e0f5f7f testClass = K8sExampleApplicationTests, locations = '{}', classes = '{class net.ameizi.k8s.example.K8sExampleApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@48fa0f47, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6d2a209c, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@4ddced80, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@76908cc0], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -\u003e true]], class annotated with @DirtiesContext [false] with mode [null].\n  11:09:32.101 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}\n  \n    .   ____          _            __ _ _\n   /\\\\ / ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n  ( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\n   \\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n    '  |____| .__|_| |_|_| |_\\__, | / / / /\n   =========|_|==============|___/=/_/_/_/\n   :: Spring Boot ::        (v2.2.6.RELEASE)\n  \n  2020-05-07 11:09:32.439  INFO 40881 --- [           main] n.a.k.e.K8sExampleApplicationTests       : Starting K8sExampleApplicationTests on swfeng.local with PID 40881 (started by amz in /Users/amz/develop/workspace/k8s-example)\n  2020-05-07 11:09:32.440  INFO 40881 --- [           main] n.a.k.e.K8sExampleApplicationTests       : No active profile set, falling back to default profiles: default\n  2020-05-07 11:09:34.552  INFO 40881 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'\n  2020-05-07 11:09:35.159  INFO 40881 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'\n  2020-05-07 11:09:35.242  INFO 40881 --- [           main] n.a.k.e.K8sExampleApplicationTests       : Started K8sExampleApplicationTests in 3.126 seconds (JVM running for 4.349)\n  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.144 s - in net.ameizi.k8s.example.K8sExampleApplicationTests\n  2020-05-07 11:09:35.600  INFO 40881 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'\n  [INFO] \n  [INFO] Results:\n  [INFO] \n  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n  [INFO] \n  [INFO] \n  [INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ k8s-example ---\n  [INFO] Building jar: /Users/amz/develop/workspace/k8s-example/target/k8s-example-1.0.0.jar\n  [INFO] \n  [INFO] --- spring-boot-maven-plugin:2.2.6.RELEASE:repackage (repackage) @ k8s-example ---\n  [INFO] Replacing main artifact with repackaged archive\n  [INFO] \n  [INFO] --- jib-maven-plugin:2.2.0:build (default) @ k8s-example ---\n  [INFO] \n  [INFO] Containerizing application to registry.hub.docker.com/aimeizi/k8s-example...\n  [WARNING] Base image 'openjdk:8-jdk-alpine' does not use a specific image digest - build may not be reproducible\n  [INFO] Getting manifest for base image openjdk:8-jdk-alpine...\n  [INFO] Building dependencies layer...\n  [INFO] Building resources layer...\n  [INFO] Building classes layer...\n  [INFO] Using credentials from Docker config (/Users/amz/.docker/config.json) for registry.hub.docker.com/aimeizi/k8s-example\n  [INFO] The base image requires auth. Trying again for openjdk:8-jdk-alpine...\n  [WARNING] The credential helper (docker-credential-desktop) has nothing for server URL: registry-1.docker.io\n  \n  Got output:\n  \n  credentials not found in native keychain\n  \n  [INFO] Using credentials from Docker config (/Users/amz/.docker/config.json) for openjdk:8-jdk-alpine\n  [INFO] Using base image with digest: sha256:44b3cea369c947527e266275cee85c71a81f20fc5076f6ebb5a13f19015dce71\n  [INFO] \n  [INFO] Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, net.ameizi.k8s.example.K8sExampleApplication]\n  [INFO] \n  [INFO] Built and pushed image as registry.hub.docker.com/aimeizi/k8s-example\n  [INFO] \n  [INFO] \n  [INFO] --- jib-maven-plugin:2.2.0:dockerBuild (default-cli) @ k8s-example ---\n  [INFO] \n  [INFO] Containerizing application to Docker daemon as registry.hub.docker.com/aimeizi/k8s-example...\n  [WARNING] Base image 'openjdk:8-jdk-alpine' does not use a specific image digest - build may not be reproducible\n  [INFO] Getting manifest for base image openjdk:8-jdk-alpine...\n  [INFO] Building dependencies layer...\n  [INFO] Building resources layer...\n  [INFO] Building classes layer...\n  [INFO] The base image requires auth. Trying again for openjdk:8-jdk-alpine...\n  [WARNING] The credential helper (docker-credential-desktop) has nothing for server URL: registry-1.docker.io\n  \n  Got output:\n  \n  credentials not found in native keychain\n  \n  [INFO] Using credentials from Docker config (/Users/amz/.docker/config.json) for openjdk:8-jdk-alpine\n  [INFO] Using base image with digest: sha256:44b3cea369c947527e266275cee85c71a81f20fc5076f6ebb5a13f19015dce71\n  [INFO] \n  [INFO] Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, net.ameizi.k8s.example.K8sExampleApplication]\n  [INFO] Loading to Docker daemon...\n  [INFO] \n  [INFO] Built image to Docker daemon as registry.hub.docker.com/aimeizi/k8s-example\n  [INFO] \n  [INFO] ------------------------------------------------------------------------\n  [INFO] BUILD SUCCESS\n  [INFO] ------------------------------------------------------------------------\n  [INFO] Total time:  03:12 min\n  [INFO] Finished at: 2020-05-07T11:12:33+08:00\n  [INFO] ------------------------------------------------------------------------\n  Tags used in deployment:\n   - registry.hub.docker.com/aimeizi/k8s-example -\u003e registry.hub.docker.com/aimeizi/k8s-example:1ab1c78361f6855399f7865c3abb1b8bc6693cfc6b90edcd37fa81a98379668b\n  Starting deploy...\n   - deployment.apps/k8s-example created\n   - service/k8s-example created\n  Waiting for deployments to stabilize...\n   - deployment/k8s-example: waiting for rollout to finish: 0 of 1 updated replicas are available...\n   - deployment/k8s-example is ready.\n  Deployments stabilized in 1.262264304s\n  Port forwarding service/k8s-example in namespace default, remote port 80 -\u003e address 127.0.0.1 port 4503\n  Watching for changes...\n  [k8s-example-8469866549-s8v6s k8s-example] \n  [k8s-example-8469866549-s8v6s k8s-example]   .   ____          _            __ _ _\n  [k8s-example-8469866549-s8v6s k8s-example]  /\\\\ / ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n  [k8s-example-8469866549-s8v6s k8s-example] ( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\n  [k8s-example-8469866549-s8v6s k8s-example]  \\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n  [k8s-example-8469866549-s8v6s k8s-example]   '  |____| .__|_| |_|_| |_\\__, | / / / /\n  [k8s-example-8469866549-s8v6s k8s-example]  =========|_|==============|___/=/_/_/_/\n  [k8s-example-8469866549-s8v6s k8s-example]  :: Spring Boot ::        (v2.2.6.RELEASE)\n  [k8s-example-8469866549-s8v6s k8s-example] \n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:38.122  INFO 1 --- [  restartedMain] n.a.k8s.example.K8sExampleApplication    : Starting K8sExampleApplication on k8s-example-8469866549-s8v6s with PID 1 (/app/classes started by root in /)\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:38.128  INFO 1 --- [  restartedMain] n.a.k8s.example.K8sExampleApplication    : No active profile set, falling back to default profiles: default\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:38.208  INFO 1 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:38.208  INFO 1 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:39.900  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:39.922  INFO 1 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:39.922  INFO 1 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.33]\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:40.022  INFO 1 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:40.022  INFO 1 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1814 ms\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:40.922  INFO 1 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:41.226  INFO 1 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:41.236  INFO 1 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:41.336  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''\n  [k8s-example-8469866549-s8v6s k8s-example] 2020-05-07 03:12:41.346  INFO 1 --- [  restartedMain] n.a.k8s.example.K8sExampleApplication    : Started K8sExampleApplication in 3.714 seconds (JVM running for 4.57)\n```\n根据日志输出发现`Port forwarding service/k8s-example in namespace default, remote port 80 -\u003e address 127.0.0.1 port 4503`。\n\n```bash\n$ curl http://127.0.0.1:4503/hello\n  hello,kubernetes!\n```\n\n修改应用中的代码，并再次观察其输出\n\n```bash\n$ curl http://127.0.0.1:4503/hello\n  hello,Skaffold!\n```\n\n发现，程序修改后会自动重新构建并部署应用。\n\n当`skaffold`进程结束后会自动清理\n```\n^CCleaning up...\nWARN[0802] signal: interrupt                            \n - deployment.apps \"k8s-example\" deleted\n - service \"k8s-example\" deleted\n```\n\n执行 debug\n\n```bash\n$ skaffold debug --port-forward\nListing files to watch...\nGenerating tags...\n - registry.hub.docker.com/aimeizi/k8s-example -\u003e registry.hub.docker.com/aimeizi/k8s-example:latest\nSome taggers failed. Rerun with -vdebug for errors.\nChecking cache...\n - registry.hub.docker.com/aimeizi/k8s-example: Found Locally\nTags used in deployment:\n - registry.hub.docker.com/aimeizi/k8s-example -\u003e registry.hub.docker.com/aimeizi/k8s-example:8c60b1d982f01598222d196f322372427252593e6de28599f49cca8a45ea3229\nStarting deploy...\n - deployment.apps/k8s-example created\n - service/k8s-example created\nWaiting for deployments to stabilize...\n - deployment/k8s-example: waiting for rollout to finish: 0 of 1 updated replicas are available...\n - deployment/k8s-example is ready.\nDeployments stabilized in 1.845665959s\nPort forwarding service/k8s-example in namespace default, remote port 80 -\u003e address 127.0.0.1 port 4503\nWatching for changes...\nPort forwarding pod/k8s-example-5fbc9ff88b-pdv8m in namespace default, remote port 5005 -\u003e address 127.0.0.1 port 5005\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] Picked up JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,address=5005,suspend=n,quiet=y\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] \n[k8s-example-5fbc9ff88b-pdv8m k8s-example]   .   ____          _            __ _ _\n[k8s-example-5fbc9ff88b-pdv8m k8s-example]  /\\\\ / ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] ( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\n[k8s-example-5fbc9ff88b-pdv8m k8s-example]  \\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n[k8s-example-5fbc9ff88b-pdv8m k8s-example]   '  |____| .__|_| |_|_| |_\\__, | / / / /\n[k8s-example-5fbc9ff88b-pdv8m k8s-example]  =========|_|==============|___/=/_/_/_/\n[k8s-example-5fbc9ff88b-pdv8m k8s-example]  :: Spring Boot ::        (v2.2.6.RELEASE)\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] \n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:27.077  INFO 1 --- [  restartedMain] n.a.k8s.example.K8sExampleApplication    : Starting K8sExampleApplication on k8s-example-5fbc9ff88b-pdv8m with PID 1 (/app/classes started by root in /)\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:27.090  INFO 1 --- [  restartedMain] n.a.k8s.example.K8sExampleApplication    : No active profile set, falling back to default profiles: default\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:27.202  INFO 1 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:27.205  INFO 1 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:28.990  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:29.010  INFO 1 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:29.010  INFO 1 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.33]\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:29.115  INFO 1 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:29.115  INFO 1 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1905 ms\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:30.167  INFO 1 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:30.650  INFO 1 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:30.664  INFO 1 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:30.806  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''\n[k8s-example-5fbc9ff88b-pdv8m k8s-example] 2020-05-07 03:24:30.818  INFO 1 --- [  restartedMain] n.a.k8s.example.K8sExampleApplication    : Started K8sExampleApplication in 4.549 seconds (JVM running for 5.451)\n```\n根据日志输出，在 ide 中进行设置即可\n```\n-agentlib:jdwp=transport=dt_socket,server=y,address=5005,suspend=n,quiet=y\n```\n![](Screenshots/Snipaste_2020-05-07_11-30-43.png)\n浏览器地址栏输入`http://127.0.0.1:4503/hello`即可进入断点模式\n![](Screenshots/Snipaste_2020-05-07_11-31-34.png)\n\n### Kustomize\n\n执行如下命令创建目录\n\n```bash\n$ mkdir -p kustomize/base\n$ mv k8s/* kustomize/base\n$ rm -Rf k8s\n```\n\n在`kustomize/base`目录下创建`kustomization.yaml`文件，其内容为\n\n```yaml\napiVersion: kustomize.config.k8s.io/v1beta1\nkind: Kustomization\n\nresources:\n  - service.yaml\n  - deployment.yaml\n```\n在`kustomize/qa`目录下创建`update-replicas.yaml`文件，其内容为\n```bash\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: k8s-example\nspec:\n  replicas: 2\n```\n\n在`kustomize/qa`目录下创建`kustomization.yaml`文件，其内容为\n\n```yaml\napiVersion: kustomize.config.k8s.io/v1beta1\nkind: Kustomization\n\nresources:\n  - ../base\n\npatchesStrategicMerge:\n  - update-replicas.yaml\n```\n\n运行 Kustomize\n\n执行构建\n\n```bash\n$ kustomize build ./kustomize/base\n  apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: null\n    labels:\n      app: k8s-example\n    name: k8s-example\n  spec:\n    ports:\n    - name: 80-8080\n      port: 80\n      protocol: TCP\n      targetPort: 8080\n    selector:\n      app: k8s-example\n    type: LoadBalancer\n  status:\n    loadBalancer: {}\n  ---\n  apiVersion: apps/v1\n  kind: Deployment\n  metadata:\n    creationTimestamp: null\n    labels:\n      app: k8s-example\n    name: k8s-example\n  spec:\n    replicas: 1\n    selector:\n      matchLabels:\n        app: k8s-example\n    strategy: {}\n    template:\n      metadata:\n        creationTimestamp: null\n        labels:\n          app: k8s-example\n      spec:\n        containers:\n        - image: registry.hub.docker.com/aimeizi/k8s-example:latest\n          name: k8s-example\n          resources: {}\n  status: {}\n```\n\n```bash\n$ kustomize build ./kustomize/qa\n  apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: null\n    labels:\n      app: k8s-example\n    name: k8s-example\n  spec:\n    ports:\n    - name: 80-8080\n      port: 80\n      protocol: TCP\n      targetPort: 8080\n    selector:\n      app: k8s-example\n    type: LoadBalancer\n  status:\n    loadBalancer: {}\n  ---\n  apiVersion: apps/v1\n  kind: Deployment\n  metadata:\n    creationTimestamp: null\n    labels:\n      app: k8s-example\n    name: k8s-example\n  spec:\n    replicas: 2\n    selector:\n      matchLabels:\n        app: k8s-example\n    strategy: {}\n    template:\n      metadata:\n        creationTimestamp: null\n        labels:\n          app: k8s-example\n      spec:\n        containers:\n        - image: registry.hub.docker.com/aimeizi/k8s-example:latest\n          name: k8s-example\n          resources: {}\n  status: {}\n```\n\n部署应用服务\n\n```bash\n$ kustomize build kustomize/qa | kubectl apply -f -\n  service/k8s-example created\n  deployment.apps/k8s-example created\n```\n\n查看状态\n\n```bash\n$ watch -n 1 kubectl get all\nEvery 1.0s: kubectl get all                                     swfeng.local: Thu May  7 15:48:05 2020\n\nNAME                               READY   STATUS    RESTARTS   AGE\npod/k8s-example-664b9f68d4-qzfqs   1/1     Running   0          116s\npod/k8s-example-664b9f68d4-s7xv7   1/1     Running   0          116s\n\n\nNAME                  TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE\nservice/k8s-example   LoadBalancer   10.100.196.38   localhost     80:32689/TCP   116s\nservice/kubernetes    ClusterIP      10.96.0.1       \u003cnone\u003e        443/TCP        15d\n```\n\n运行测试\n\n```bash\n$ curl http://127.0.0.1/hello\n  hello,Skaffold!\n```\n\n此时发现`k8s-example`在两个Pod间具有LoadBalancer\n\n清理资源\n\n```bash\n$ kustomize build kustomize/qa | kubectl delete -f -\n```\n\n### Kustomize 整合 Skaffold\n\n默认情况下`Skaffold`使用`kubectl`部署应用，可以修改使用`kustomize`来部署应用。其具体操作如下，修改`skaffold.yaml`配置文件内容如下所示：\n\n```yaml\napiVersion: skaffold/v2beta3\nkind: Config\nmetadata:\n  name: k-s-example\nbuild:\n  artifacts:\n  - image: registry.hub.docker.com/aimeizi/k8s-example\n    jib:\n      project: net.ameizi:k8s-example\ndeploy:\n#  kubectl:\n#    manifests:\n#    - k8s/deployment.yaml\n#    - k8s/service.yaml\n  kustomize:\n    paths: [\"kustomize/base\"]\nprofiles:\n  - name: qa\n    deploy:\n      kustomize:\n        paths: [\"kustomize/qa\"]\n```\n\n即修改deploy的kubectl属性为kustomize\n\n测试Skaffold整合Kustomize后的效果\n\n```bash\n$ skaffold dev\n```\n\n注：以上命令默认执行`kustomize/base`目录下的配置\n\n```bash\n$ skaffold dev -p qa\n```\n注：以上命令执行`kustomize/qa`目录下的配置\n\n\n### kt-connect本地联调\n\n检查版本信息\n```bash\n$ ktctl --version\n  KT Connect version kt-0.0.12\n```\n\n启动ktctl\n```bash\n$ sudo ktctl -d connect --method socks5\n  Password:\n  4:13PM INF Connect Start At 58263\n  4:13PM INF Client address 172.24.202.121\n  4:13PM INF deploy shadow deployment kt-connect-daemon-qocry in namespace default\n  \n  4:13PM INF pod label: kt=kt-connect-daemon-qocry\n  4:13PM INF pod: kt-connect-daemon-qocry-5f976c8848-nzn67 is running,but not ready\n  4:13PM INF pod: kt-connect-daemon-qocry-5f976c8848-nzn67 is running,but not ready\n  4:13PM INF pod: kt-connect-daemon-qocry-5f976c8848-nzn67 is running,but not ready\n  4:13PM INF Shadow pod: kt-connect-daemon-qocry-5f976c8848-nzn67 is ready.\n  4:13PM INF Fail to get pod cidr from node.Spec.PODCIDR, try to get with pod sample\n  4:13PM DBG Child, os.Args = [ktctl -d connect --method socks5]\n  4:13PM DBG Child, cmd.Args = [kubectl --kubeconfig=/Users/amz/.kube/config -n default port-forward kt-connect-daemon-qocry-5f976c8848-nzn67 2222:22]\n  Forwarding from 127.0.0.1:2222 -\u003e 22\n  Forwarding from [::1]:2222 -\u003e 22\n  4:13PM INF port-forward start at pid: 58266\n  4:13PM INF ==============================================================\n  4:13PM INF Start SOCKS5 Proxy: export http_proxy=socks5://127.0.0.1:2223\n  4:13PM INF ==============================================================\n  4:13PM DBG Child, os.Args = [ktctl -d connect --method socks5]\n  4:13PM DBG Child, cmd.Args = [ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -i /Users/amz/.kt_id_rsa -D 2223 root@127.0.0.1 -p2222 sh loop.sh]\n  Handling connection for 2222\n  Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.\n  4:13PM INF vpn(ssh) start at pid: 58268\n  4:13PM INF KT proxy start successful\n```\n\n根据日志输出在终端设置`http_proxy`环境变量，然后使用`CLUSTER-IP:PORT`访问应用\n\n查看服务端口映射信息\n```bash\n$ watch -n 1 kubectl get all\nEvery 1.0s: kubectl get all                                     swfeng.local: Thu May  7 16:17:54 2020\n\nNAME                                           READY   STATUS    RESTARTS   AGE\npod/k8s-example-55697bcd6b-kwzhf               1/1     Running   0          5m18s\npod/kt-connect-daemon-izhxa-6f95f75678-k578z   1/1     Running   0          7m38s\npod/kt-connect-daemon-qocry-5f976c8848-nzn67   1/1     Running   0          4m34s\n\n\nNAME                  TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE\nservice/k8s-example   LoadBalancer   10.100.27.20   localhost     80:32106/TCP   5m18s\nservice/kubernetes    ClusterIP      10.96.0.1      \u003cnone\u003e        443/TCP        15d\n```\n命令行验证\n```bash\n$ export http_proxy=socks5://127.0.0.1:2223\n$ curl http://10.100.27.20:80/hello\n  hello,Skaffold!\n```\n\nIDEA中与Kubernetes集群中的程序联调\n\nktctl在socks5模式下，会自动在当前路径下生成.jvmrc文件，该文件中会包含SOCKS5代理的相关JVM参数。其内容如下所示：\n\n```\n-DsocksProxyHost=127.0.0.1\n-DsocksProxyPort=2223\n```\n在 ide 中安装`JVM Inject`插件，在IDEA中启动Java程序时，该插件会自动加载当前项目根路径下的.jvmrc并追加到Java的启动参数中。具体如下所示\n\n```\n/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:52776,suspend=y,server=n -Dvisualvm.id=90478590646964 -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=2223 \n```\n之后可以在 ide 中直接访问k8s中的服务。\n\n### 远程调试\n\n```\nFROM openjdk:8-jdk-alpine\nVOLUME /tmp\nADD target/app.jar target/app.jar\nENTRYPOINT [\"java\",\"-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n\",\"-Djava.security.egd=file:/dev/./urandom\",\"-Xms2g\",\"-Xmx8g\",\"-jar\",\"target/app.jar\"]\n```\n\n在 Service 中暴露端口\n\n![](Screenshots/remote_debug.png)\n\n如本例可修改为\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  creationTimestamp: null\n  labels:\n    app: k8s-example\n  name: k8s-example\nspec:\n  ports:\n  - name: 80-8080\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  - name: 5005-5005\n    port: 5005\n    protocol: TCP\n    targetPort: 5005\n  selector:\n    app: k8s-example\n  type: LoadBalancer # LoadBalancer 不需要kubectl port-forward 直接用映射出来的 IP 和端口访问\nstatus:\n  loadBalancer: {}\n```\n\n### 参考文档\n\nhttps://hackmd.io/@ryanjbaxter/spring-on-k8s-workshop\n\nhttps://spring.io/blog/2020/01/27/creating-docker-images-with-spring-boot-2-3-0-m1\n\nhttps://github.com/alibaba/kt-connect\n\nhttp://ylzheng.com/2019/12/14/how-to-integration-with-kubernetes-from-idea/\n\nhttps://itnext.io/remote-debugging-spring-boot-on-kubernetes-a5f96a40e5c0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv5tech%2Fk8s-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv5tech%2Fk8s-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv5tech%2Fk8s-example/lists"}