• DevOps
  • 按照CI/CD 流水线示例 (离线版)说明,kubernetesDeploy报错

kubesphere的版本为v2.0.2
[Pipeline] kubernetesDeploy
Starting Kubernetes deployment
ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Service] with name: [ks-sample-dev] in namespace: [kubesphere-sample-dev] failed.
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Service] with name: [ks-sample-dev] in namespace: [kubesphere-sample-dev] failed.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:62)
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:71)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:206)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:162)
at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$ServiceUpdater.getCurrentResource

  • kevin 密码如果有特殊字符的话,创建凭证时候需要对密码进行url encode

麻烦贴下完整的日志、jenkinsfile以及yaml。
同时建议升级 2.1
2.1 重写了这个插件

    runzexia 非常感谢回复, 我直接用贵公司文档中GitHub 中的 devops-java-sample导入到GitLab,导入GitLab没有做任何修改,完整的日志如下:
    Started by user 004

    git rev-parse –is-inside-work-tree # timeout=10
    Setting origin to http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git
    git config remote.origin.url http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git # timeout=10
    Fetching origin…
    Fetching upstream changes from origin
    git –version # timeout=10
    git config –get remote.origin.url # timeout=10
    using GIT_ASKPASS to set credentials
    git fetch –tags –progress origin +refs/heads/:refs/remotes/origin/
    Seen branch in repository origin/dependency
    Seen branch in repository origin/master
    Seen 2 remote branches
    Obtained Jenkinsfile-on-prem from c342a3288d057fc9574a8cfae469015ff25c4a0f
    Running in Durability level: MAX_SURVIVABILITY
    [Pipeline] Start of Pipeline
    [Pipeline] node
    Still waiting to schedule task
    ‘Jenkins’ doesn’t have label ‘maven’
    Agent maven-9tjrw is provisioned from template Kubernetes Pod Template
    Agent specification [Kubernetes Pod Template] (maven):

    • [maven] kubesphere/builder-maven:advanced-1.0.0
    • [jnlp] jenkins/jnlp-slave:3.27-1(resourceRequestCpu: 100m, resourceRequestMemory: 32Mi)
    • [docker-server] docker:18.06.1-ce-dind

    Running on maven-9tjrw in /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master
    [Pipeline] {
    [Pipeline] stage
    [Pipeline] { (Declarative: Checkout SCM)
    [Pipeline] checkout
    using credential gitlab-id
    Cloning the remote Git repository
    Using shallow clone
    Cloning repository http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git

    git init /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master # timeout=10
    Fetching upstream changes from http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git
    git –version # timeout=10
    using GIT_ASKPASS to set credentials
    git fetch –tags –progress http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git +refs/heads/:refs/remotes/origin/ –depth=1 # timeout=20
    Checking out Revision c342a3288d057fc9574a8cfae469015ff25c4a0f (master)
    git config remote.origin.url http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git # timeout=10
    git config –add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
    git config remote.origin.url http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git # timeout=10
    Fetching upstream changes from http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git
    using GIT_ASKPASS to set credentials
    git fetch –tags –progress http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git +refs/heads/:refs/remotes/origin/ –depth=1 # timeout=20
    git config core.sparsecheckout # timeout=10
    git checkout -f c342a3288d057fc9574a8cfae469015ff25c4a0f
    Commit message: “Update Jenkinsfile-online”
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] withEnv
    [Pipeline] {
    [Pipeline] withEnv
    [Pipeline] {
    [Pipeline] stage
    [Pipeline] { (checkout scm)
    [Pipeline] checkout
    using credential gitlab-id
    Fetching changes from the remote Git repository
    Checking out Revision c342a3288d057fc9574a8cfae469015ff25c4a0f (master)
    Commit message: “Update Jenkinsfile-online”
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (unit test)
    [Pipeline] container
    [Pipeline] {
    [Pipeline] sh
    git rev-parse –is-inside-work-tree # timeout=10
    git config remote.origin.url http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git # timeout=10
    Fetching upstream changes from http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git
    git –version # timeout=10
    using GIT_ASKPASS to set credentials
    git fetch –tags –progress http://gitlab.devops.kubesphere.local:30080/admin1/devops-java-sample.git +refs/heads/:refs/remotes/origin/ –depth=1 # timeout=20
    git config core.sparsecheckout # timeout=10
    git checkout -f c342a3288d057fc9574a8cfae469015ff25c4a0f
    git rev-list –no-walk c342a3288d057fc9574a8cfae469015ff25c4a0f # timeout=10
    ++ pwd

    • mvn clean -o -gs /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/configuration/settings.xml test
      [INFO] Scanning for projects…
      [INFO]
      [INFO] —————–< io.kubesphere.devops:devops-sample >—————–
      [INFO] Building devops-sample :: HelloWorld Demo 0.0.1-SNAPSHOT
      [INFO] ——————————–[ jar ]———————————
      [INFO]
      [INFO] — maven-clean-plugin:2.6.1:clean (default-clean) @ devops-sample —
      [INFO]
      [INFO] — jacoco-maven-plugin:0.8.2:prepare-agent (agent-for-ut) @ devops-sample —
      [INFO] argLine set to -javaagent:/home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/artifacts/m2/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/jacoco.exec,append=true
      [INFO]
      [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ devops-sample —
      [INFO] Using ‘UTF-8′ encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/src/main/resources
      [INFO] skip non existing resourceDirectory /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/src/main/resources
      [INFO]
      [INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ devops-sample —
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 2 source files to /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/classes
      [INFO]
      [INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ devops-sample —
      [INFO] Using ‘UTF-8’ encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/src/test/resources
      [INFO]
      [INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ devops-sample —
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/test-classes
      [INFO]
      [INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ devops-sample —
      [INFO] Surefire report directory: /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/surefire-reports

    T E S T S

    Running io.kubesphere.devops.HelloWorldControllerTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in io.kubesphere.devops.HelloWorldControllerTest

    Results :

    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

    [INFO] ————————————————————————
    [INFO] BUILD SUCCESS
    [INFO] ————————————————————————
    [INFO] Total time: 2.709 s
    [INFO] Finished at: 2019-11-21T16:38:39Z
    [INFO] ————————————————————————
    [Pipeline] }
    [Pipeline] // container
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (sonarqube analysis)
    [Pipeline] container
    [Pipeline] {
    [Pipeline] withCredentials
    Masking only exact matches of $SONAR_TOKEN
    [Pipeline] {
    [Pipeline] withSonarQubeEnv
    Injecting SonarQube environment variables using the configuration: sonar
    [Pipeline] {
    [Pipeline] sh
    ++ pwd

    • mvn sonar:sonar -o -gs /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/configuration/settings.xml -Dsonar.branch=master -Dsonar.login=****
      [INFO] Scanning for projects…
      [INFO]
      [INFO] —————–< io.kubesphere.devops:devops-sample >—————–
      [INFO] Building devops-sample :: HelloWorld Demo 0.0.1-SNAPSHOT
      [INFO] ——————————–[ jar ]———————————
      [INFO]
      [INFO] — sonar-maven-plugin:3.6.0.1398:sonar (default-cli) @ devops-sample —
      [INFO] User cache: /root/.sonar/cache
      [INFO] SonarQube version: 7.4.0
      [INFO] Default locale: “en_US”, source code encoding: “UTF-8″
      [INFO] Publish mode
      [INFO] Load global settings
      [INFO] Load global settings (done) | time=111ms
      [INFO] Server id: 19287ED2-AW6HF6h2ng-Qy792Ljv
      [INFO] User cache: /root/.sonar/cache
      [INFO] Load/download plugins
      [INFO] Load plugins index
      [INFO] Load plugins index (done) | time=61ms
      [INFO] Load/download plugins (done) | time=799ms
      [INFO] Loaded core extensions:
      [INFO] Process project properties
      [INFO] Load project repositories
      [INFO] Load project repositories (done) | time=104ms
      [INFO] Load quality profiles
      [INFO] Load quality profiles (done) | time=35ms
      [INFO] Load active rules
      [INFO] Load active rules (done) | time=422ms
      [INFO] Load metrics repository
      [INFO] Load metrics repository (done) | time=16ms
      [INFO] Project key: io.kubesphere.devops:devops-sample
      [INFO] Project base dir: /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master
      [INFO] Branch key: master
      [WARNING] The use of “sonar.branch” is deprecated and replaced by “sonar.branch.name”. See https://redirect.sonarsource.com/doc/branches.html.
      [INFO] ————- Scan devops-sample :: HelloWorld Demo
      [INFO] Base dir: /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master
      [INFO] Working dir: /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/sonar
      [INFO] Source paths: pom.xml, src/main/java
      [INFO] Test paths: src/test/java
      [INFO] Source encoding: UTF-8, default locale: en_US
      [INFO] Load server rules
      [INFO] Load server rules (done) | time=80ms
      [INFO] Index files
      [INFO] 4 files indexed
      [INFO] Quality profile for java: Sonar way
      [INFO] Quality profile for xml: Sonar way
      [INFO] Sensor JavaSquidSensor [java]
      [INFO] Configured Java source version (sonar.java.source): 6
      [INFO] JavaClasspath initialization
      [INFO] JavaClasspath initialization (done) | time=14ms
      [INFO] JavaTestClasspath initialization
      [INFO] JavaTestClasspath initialization (done) | time=1ms
      [INFO] Java Main Files AST scan
      [INFO] 2 source files to be analyzed
      [INFO] Java Main Files AST scan (done) | time=450ms
      [INFO] 2/2 source files have been analyzed
      [INFO] Java Test Files AST scan
      [INFO] 1 source files to be analyzed
      [INFO] 1/1 source files have been analyzed
      [INFO] Java Test Files AST scan (done) | time=29ms
      [INFO] Sensor JavaSquidSensor [java] (done) | time=1114ms
      [INFO] Sensor JaCoCo XML Report Importer [jacoco]
      [INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
      [INFO] Sensor SurefireSensor [java]
      [INFO] parsing [/home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/surefire-reports]
      [INFO] Sensor SurefireSensor [java] (done) | time=92ms
      [INFO] Sensor JaCoCoSensor [java]
      [INFO] Analysing /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/./target/jacoco.exec
      [INFO] No information about coverage per test.
      [INFO] Sensor JaCoCoSensor [java] (done) | time=56ms
      [INFO] Sensor SonarJavaXmlFileSensor [java]
      [INFO] 1 source files to be analyzed
      [INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=489ms
      [INFO] Sensor XML Sensor [xml]
      [INFO] 1/1 source files have been analyzed
      [WARNING] Metric ‘comment_lines_data’ is deprecated. Provided value is ignored.
      [INFO] Sensor XML Sensor [xml] (done) | time=157ms
      [INFO] Sensor Zero Coverage Sensor
      [INFO] Sensor Zero Coverage Sensor (done) | time=11ms
      [INFO] Sensor Java CPD Block Indexer
      [INFO] Sensor Java CPD Block Indexer (done) | time=14ms
      [INFO] SCM provider for this project is: git
      [INFO] 4 files to be analyzed
      [WARNING] Shallow clone detected, no blame information will be provided. You can convert to non-shallow with ‘git fetch –unshallow’.
      [INFO] 0/4 files analyzed
      [WARNING] Missing blame information for the following files:
      [WARNING] * pom.xml
      [WARNING] * src/main/java/io/kubesphere/devops/Application.java
      [WARNING] * src/main/java/io/kubesphere/devops/HelloWorldController.java
      [WARNING] * src/test/java/io/kubesphere/devops/HelloWorldControllerTest.java
      [WARNING] This may lead to missing/broken features in SonarQube
      [INFO] 2 files had no CPD blocks
      [INFO] Calculating CPD for 0 files
      [INFO] CPD calculation finished
      [INFO] Analysis report generated in 98ms, dir size=47 KB
      [INFO] Analysis reports compressed in 12ms, zip size=16 KB
      [INFO] Analysis report uploaded in 21ms
      [INFO] ANALYSIS SUCCESSFUL, you can browse http://10.10.5.101:30304/dashboard?id=io.kubesphere.devops%3Adevops-sample%3Amaster
      [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
      [INFO] More about the report processing at http://10.10.5.101:30304/api/ce/task?id=AW6O1KMong-
      Qy792Nc6
      [INFO] Task total time: 5.063 s
      [INFO] ————————————————————————
      [INFO] BUILD SUCCESS
      [INFO] ————————————————————————
      [INFO] Total time: 8.241 s
      [INFO] Finished at: 2019-11-21T16:38:50Z
      [INFO] ————————————————————————
      [Pipeline] }
      [Pipeline] // withSonarQubeEnv
      [Pipeline] }
      [Pipeline] // withCredentials
      [Pipeline] timeout
      Timeout set to expire in 1 hr 0 min
      [Pipeline] {
      [Pipeline] waitForQualityGate
      Checking status of SonarQube task ‘AW6O1KMong-Qy792Nc6′ on server ‘sonar’
      SonarQube task ‘AW6O1KMong-
      Qy792Nc6’ status is ‘PENDING’
      SonarQube task ‘AW6O1KMong-Qy792Nc6’ status is ‘SUCCESS’
      SonarQube task ‘AW6O1KMong-
      Qy792Nc6’ completed. Quality gate is ‘OK’
      [Pipeline] }
      [Pipeline] // timeout
      [Pipeline] }
      [Pipeline] // container
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (build & push)
      [Pipeline] container
      [Pipeline] {
      [Pipeline] sh
      ++ pwd
    • mvn -o -Dmaven.test.skip=true -gs /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/configuration/settings.xml clean package
      [INFO] Scanning for projects…
      [INFO]
      [INFO] —————–< io.kubesphere.devops:devops-sample >—————–
      [INFO] Building devops-sample :: HelloWorld Demo 0.0.1-SNAPSHOT
      [INFO] ——————————–[ jar ]———————————
      [INFO]
      [INFO] — maven-clean-plugin:2.6.1:clean (default-clean) @ devops-sample —
      [INFO] Deleting /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target
      [INFO]
      [INFO] — jacoco-maven-plugin:0.8.2:prepare-agent (agent-for-ut) @ devops-sample —
      [INFO] argLine set to -javaagent:/home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/artifacts/m2/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/jacoco.exec,append=true
      [INFO]
      [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ devops-sample —
      [INFO] Using ‘UTF-8′ encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/src/main/resources
      [INFO] skip non existing resourceDirectory /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/src/main/resources
      [INFO]
      [INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ devops-sample —
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 2 source files to /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/classes
      [INFO]
      [INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ devops-sample —
      [INFO] Not copying test resources
      [INFO]
      [INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ devops-sample —
      [INFO] Not compiling test sources
      [INFO]
      [INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ devops-sample —
      [INFO] Tests are skipped.
      [INFO]
      [INFO] — maven-jar-plugin:2.6:jar (default-jar) @ devops-sample —
      [INFO] Building jar: /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/target/devops-sample-0.0.1-SNAPSHOT.jar
      [INFO]
      [INFO] — spring-boot-maven-plugin:1.4.1.BUILD-SNAPSHOT:repackage (default) @ devops-sample —
      [INFO] ————————————————————————
      [INFO] BUILD SUCCESS
      [INFO] ————————————————————————
      [INFO] Total time: 2.468 s
      [INFO] Finished at: 2019-11-21T16:38:57Z
      [INFO] ————————————————————————
      [Pipeline] sh
    • docker build -f Dockerfile-on-prem -t harbor.devops.kubesphere.local:30280/library/devops-java-sample:SNAPSHOT-master-12 .
      Sending build context to Docker daemon 119.8MB

    Step ¼ : FROM harbor.devops.kubesphere.local:30280/library/java:openjdk-8-jre-alpine
    openjdk-8-jre-alpine: Pulling from library/java
    53478ce18e19: Pulling fs layer
    d1c225ed7c34: Pulling fs layer
    c6724ba0c09a: Pulling fs layer
    d1c225ed7c34: Verifying Checksum
    d1c225ed7c34: Download complete
    53478ce18e19: Verifying Checksum
    53478ce18e19: Download complete
    53478ce18e19: Pull complete
    d1c225ed7c34: Pull complete
    c6724ba0c09a: Verifying Checksum
    c6724ba0c09a: Download complete
    c6724ba0c09a: Pull complete
    Digest: sha256:955dbe76c31f802d537d0c5e4160b3a010091e7e8323f46ecbb2a0f2174a5ef5
    Status: Downloaded newer image for harbor.devops.kubesphere.local:30280/library/java:openjdk-8-jre-alpine
    —> fdc893b19a14
    Step 2/4 : WORKDIR /home
    —> Running in fe3e558e1812
    Removing intermediate container fe3e558e1812
    —> 45a998e54823
    Step ¾ : COPY target/*.jar /home
    —> 8398718fef66
    Step 4/4 : ENTRYPOINT java -jar *.jar
    —> Running in 1702026759dd
    Removing intermediate container 1702026759dd
    —> 67caaa8bb025
    Successfully built 67caaa8bb025
    Successfully tagged harbor.devops.kubesphere.local:30280/library/devops-java-sample:SNAPSHOT-master-12
    [Pipeline] withCredentials
    Masking only exact matches of $DOCKER_USERNAME or $DOCKER_PASSWORD
    [Pipeline] {
    [Pipeline] sh

    Login Succeeded
    [Pipeline] sh

    • docker push harbor.devops.kubesphere.local:30280/library/devops-java-sample:SNAPSHOT-master-12
      The push refers to repository [harbor.devops.kubesphere.local:30280/library/devops-java-sample]
      2e48022f831a: Preparing
      20dd87a4c2ab: Preparing
      78075328e0da: Preparing
      9f8566ee5135: Preparing
      20dd87a4c2ab: Layer already exists
      78075328e0da: Layer already exists
      9f8566ee5135: Layer already exists
      2e48022f831a: Pushed
      SNAPSHOT-master-12: digest: sha256:8e0817bcb5ab721166034c72cd877888f2819dc93b32557e695a09243401677f size: 1159
      [Pipeline] }
      [Pipeline] // withCredentials
      [Pipeline] }
      [Pipeline] // container
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (push latest)
      [Pipeline] container
      [Pipeline] {
      [Pipeline] sh
    • docker tag harbor.devops.kubesphere.local:30280/library/devops-java-sample:SNAPSHOT-master-12 harbor.devops.kubesphere.local:30280/library/devops-java-sample:latest
      [Pipeline] sh
    • docker push harbor.devops.kubesphere.local:30280/library/devops-java-sample:latest
      The push refers to repository [harbor.devops.kubesphere.local:30280/library/devops-java-sample]
      2e48022f831a: Preparing
      20dd87a4c2ab: Preparing
      78075328e0da: Preparing
      9f8566ee5135: Preparing
      20dd87a4c2ab: Layer already exists
      78075328e0da: Layer already exists
      9f8566ee5135: Layer already exists
      2e48022f831a: Layer already exists
      latest: digest: sha256:8e0817bcb5ab721166034c72cd877888f2819dc93b32557e695a09243401677f size: 1159
      [Pipeline] }
      [Pipeline] // container
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (deploy to dev)
      [Pipeline] input
      deploy to dev?
      Proceed or Abort
      Approved by 004
      [Pipeline] kubernetesDeploy
      Starting Kubernetes deployment
      ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Service] with name: [ks-sample-dev] in namespace: [kubesphere-sample-dev] failed.
      hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Service] with name: [ks-sample-dev] in namespace: [kubesphere-sample-dev] failed.
      at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:62)
      at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:71)
      at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:206)
      at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:162)
      at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$ServiceUpdater.getCurrentResource(KubernetesClientWrapper.java:446)
      at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$ServiceUpdater.getCurrentResource(KubernetesClientWrapper.java:435)
      at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$ResourceUpdater.createOrApply(KubernetesClientWrapper.java:358)
      at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:160)
      at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:168)
      at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:122)
      at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:105)
      at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      at hudson.remoting.Request$2.run(Request.java:369)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
      at java.lang.Thread.run(Thread.java:748)
      Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.233.87.160/10.233.87.160:38418
      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
      at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
      at hudson.remoting.Channel.call(Channel.java:955)
      at hudson.FilePath.act(FilePath.java:1163)
      at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:67)
      at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:46)
      at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
      at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
      at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
      at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
      at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
      at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
      at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
      at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      … 1 more
      Caused by: hudson.remoting.ProxyException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
      at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1964)
      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:328)
      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322)
      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1633)
      at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
      at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
      at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
      at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:299)
      at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:268)
      at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
      at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
      at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
      at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
      at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      at io.fabric8.kubernetes.client.utils.ImpersonatorInterceptor.intercept(ImpersonatorInterceptor.java:54)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      at io.fabric8.kubernetes.client.utils.HttpClientUtils$2.intercept(HttpClientUtils.java:95)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
      at okhttp3.RealCall.execute(RealCall.java:77)
      at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:379)
      at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:344)
      at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:313)
      at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:296)
      at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:770)
      at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:195)
      … 17 more
      Caused by: hudson.remoting.ProxyException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
      at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
      at sun.security.validator.Validator.validate(Validator.java:262)
      at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
      at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
      at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1615)
      … 55 more
      Caused by: hudson.remoting.ProxyException: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
      at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
      at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
      at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
      … 61 more
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (push with tag)
      Stage “push with tag” skipped due to earlier failure(s)
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (deploy to production)
      Stage “deploy to production” skipped due to earlier failure(s)
      [Pipeline] }
      Loading configuration: /home/jenkins/workspace/9VZy7m_jenkinsfile-in-scm_master/deploy/dev/devops-sample-svc.yaml
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: Kubernetes deployment ended with HasError
      Finished: FAILURE

      kevin 检查一下kubeconfig凭证是否是正确的,看起来是凭证的错误。

        runzexia 确实是kubeconfig凭证问题,我当时在WEB页面里面的kubeconfig取的数据,回来ssh到服务器的/.kube/config取出来的数据就正确了,但是在push with tag 又失败了,凭证里面gitlab的账号admin,密码P@88w0rd
        release image with tag?
        Proceed or Abort
        Approved by 004
        [Pipeline] withCredentials
        Masking only exact matches of $GIT_USERNAME or $GIT_PASSWORD
        [Pipeline] {
        [Pipeline] sh

        runzexia 感谢回复,我这是all-in-one模式部署的,我在这台机器的/etc/hosts

        10.10.5.101 harbor.devops.kubesphere.local
        10.10.5.101 gitlab.devops.kubesphere.local

        同时也通过kubectl edit configmap coredns -n kube-system -o yaml添加了
        hosts {
        10.10.5.101 harbor.devops.kubesphere.local
        10.10.5.101 gitlab.devops.kubesphere.local
        fallthrough
        }
        通过以上步骤,还是出问题,所以才反馈,不知道还有什么地方可以进行排查

          kevin 排查下容器平台中的容器是否可以真的找到此域名

            runzexia 我找了本次流水线里面生成的容器里面进行ping正常
            /home # ping gitlab.devops.kubesphere.local
            PING gitlab.devops.kubesphere.local (10.10.5.101): 56 data bytes
            64 bytes from 10.10.5.101: seq=0 ttl=64 time=0.045 ms
            64 bytes from 10.10.5.101: seq=1 ttl=64 time=0.071 ms
            64 bytes from 10.10.5.101: seq=2 ttl=64 time=0.075 ms
            64 bytes from 10.10.5.101: seq=3 ttl=64 time=0.080 ms

              kevin 密码如果有特殊字符的话,创建凭证时候需要对密码进行url encode

                runzexia 确实是特殊字符问题,我用的默认密码P@88w0rd,@这个特殊字符看来是不能使用了,密码进行url encode,现在已解决,整个流水线demo跑成功了,谢谢!