How to Setup Jenkins Build Agents on Kubernetes Pods

来自linux中国网wiki
Evan讨论 | 贡献2024年8月30日 (五) 03:05的版本 →‎prouble
跳到导航 跳到搜索


==

prouble


failed to set up watcher on kubernetes  
web-pipeline-demo-6-17h0h-lrwnf-8l4w5’ is offline

今天的书写少一行  参考了去年的书搞定 
办法  添加多 cloud 'Kubernetes' 这一行 Credentials

pipeline {
  agent {
    kubernetes {
      cloud 'Kubernetes'
      yaml '''
        apiVersion: v1
        kind: Pod
        metadata:
          labels:
            app: jenkins-slave
        spec:
          containers:
          - name: jnlp
            image: 'registry.cn-hangzhou.aliyuncs.com/evan886/my_k8s_containers:inbound-agentv2024'
            args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)']
        '''
    }
  }

    stages {
        stage('Main') {
            steps {
                echo 'HI evan'
                sh 'hostname'
            }
        }
    }
}