1. User relative directory cat ~/.kube/config
echo (data of certificate-authority-data) | base64 > ca.crt
echo (data of client-certificate-data) | base64 > client.crt
echo (client-key- data) | base64 > client.key
2、Manage Jenkins->Manage nodes and clouds ->config clouds
3. Select X.509 client Certificate
4.
5. Jenkins address: fill in kubectl get ep jenkins (service)
6. Manage Jenkins->config global security->agents:
select fix: 50000, check Inbound TCP Agent Protocol/4
7. Write the script in the pipeline:
def label = “mypod-${UUID.randomUUID().toString()}”
podTemplate(label: label, cloud: 'kubernetes') { node(label) { stage('Run shell') { sh 'sleep 130s' sh 'echo hello world.' } } } 8. Run the script