一、安装kubernetes-plugin插件
系统管理 --> 系统配置 --> Cloud
二、测试创建pipline
新建任务 --> jenkins-slave-test --> 流水线
pipeline{ agent{ kubernetes{ label "jenkins-slave" cloud 'kubernetes' yaml ''' apiVersion: v1 kind: Pod metadata: name: jenkins-slave namespace: kube-ops labels: app: jenkins-slave spec: containers: - name: jenkins-slave image: 172.20.48.53/kube-ops/jenkins-slave:v1 imagePullPolicy: Always resources: requests: cpu: "500m" memory: "512Mi" volumeMounts: - name: docker-sock mountPath: /var/run/docker.sock imagePullSecrets: - name: harbor-admin volumes: - name: docker-sock hostPath: path: /var/run/docker.sock type: File ''' } } stages{ stage("test"){ steps{ script{ sh "echo 111" } } } } }
build --> consoleOut