Jenkins - Kubernetes Plugin Agents not deployed to configured cloud

Viewed 135

we are currently trying to get our Jenkins to deploy agents in another Kubernetes Cluster (provided via GKE).

We have added the new cluster under /configureClouds and are referencing it in the pipeline script via cloud: 'devkube'

Cloud Configuration

Basic Jenkinsfile:

pipeline {

  agent none

  stages {
    stage('Start manangement container') {
      agent {
        kubernetes {
          cloud 'devkube'
          defaultContainer 'management'
          yaml '''
            apiVersion: v1
            kind: Pod
            spec:
              containers:
              - name: management
                image: eu.gcr.io/dev/management:latest
                command:
                - cat
                tty: true
            '''
        }
      }

      steps {
        sleep 300
      }
    }
  }
}

Problem is that, Jenkins does not deploy the agent to that cloud, but to our first Kubernetes cluster, that has the default name kubernetes.

We have already verified, that the name provided via cloud: ... is checked against the configured clouds; a mismatch results in an immediate error.

Executing "Test Connection" under /configureClouds reports success, but value is limited as it only reports the Cluster version.

Build output recognizes the configured cloud: Created Pod: devkube default/tools-01-test-pipelines-test-9-3xd3b-17c8j-6q6xj, but the pod will be deployed to kubernetes anyhow.

Are we missing anything obvious, or is there a known bug?

Used versions:

  • Jenkins: 2.263.1
  • Kubernetes Plugin: 1.28.5
0 Answers
Related