def label = "jnlp-slave"
podTemplate(label: label, cloud: 'kubernetes',containers: [
containerTemplate(name: 'jnlp-slave', image: 'jenkinsci/jnlp-slave:v1')
],
volumes: [hostPathVolume(mounntPath:'/opt/maven/repository',hostPath:'/ceph/maven/repository'),
hostPathVolume(mounntPath:'/usr/bin/docker',hostPath:'/usr/bin/docker'),
hostPathVolume(mounntPath:'/var/run/docker.sock',hostPath:'/var/run/docker.sock')]) {
node(label) {
stage('Get a Maven project') {
container(label) {
stage('wait for exec check'){
sh 'sleep 10'
} stage('deploy'){
echo 'deploy'
sh '''
cat >deploy.yaml<<EOF
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: http-test-dm2
spec:
replicas: 1
template:
metadata:
labels:
name: http-test-dm2
spec:
containers:
- name: http-test-con
image: nginx:alpine
imagePullPolicy: Never
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: http-nginx-ser
spec:
type: NodePort
ports:
- port: 80
nodePort: 31000
targetPort: 80
selector:
name: http-test-dm2
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: grafana
spec:
rules:
- host: www.nginx2.com
http:
paths:
- path: /
backend:
serviceName: http-nginx-ser
servicePort: 80
EOF '''
}
stage('deploy to k8s'){
sh 'sleep 5'
kubernetesDeploy configs: '', kubeConfig: [path: ''], kubeconfigId: '', secretName: '', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
} }
}
}
}

pipline脚本k8s版的更多相关文章

  1. k8s版jenkins--master/slave模式实现CI/CD---带solo开源博客项目--带maven、djk、git工具

    k8s环境: 192.168.0.91 master 192.168.0.92 node 192.168.0.96 gitlab 192.168.0.98 harbor k8s集群安装请参照:http ...

  2. office全系列激活脚本-改良版

    @ECHO OFFTITLE office 全版本系统激活@echo offfor /l %%a in (8,1,16) do (for /f "tokens=*" %%i in ...

  3. windows全系列激活脚本-改良版.cmd

    @ECHO OFFTITLE Windows 全版本系统激活cscript //nologo %Systemroot%\system32\slmgr.vbs -skms 10.1.1.12ECHO 检 ...

  4. office全系列激活脚本-改良版.cmd

    @ECHO OFFTITLE office 全版本系统激活@echo offfor /l %%a in (8,1,16) do (for /f "tokens=*" %%i in ...

  5. 分享一例脚本发版和tomcat重启脚本

    线上有个网站业务部署在tomcat上,由于频繁上线修改,需要经常启动tomcat.tomcat服务自带的bin下没有重启脚本,下面分享一例脚本发版和tomcat重启脚本: 1)现将业务代码从svn里下 ...

  6. linux Tomcat restart脚本简单版

    linux系统下重启tomcat的shell脚本: tomcat_home=/opt/apache-tomcat-6.0.32  #找到tomcat进程的id并kill掉 ps -ef |grep t ...

  7. 批量备份数据库脚本(PowerShell版)

    开始 昨天备份一个数据库拿来测试,发现备份后的文件非常大.后来去检查下使用的备份脚本,原来之前的备份脚本没有压缩功能. 现把之前的备份脚本修改下,支持压缩备份,和支持仅复制备份(CopyOnly). ...

  8. CentOS6、7优化脚本完美版

    #!/bin/bash SysVer=`cat /etc/redhat-release | awk -F'release' '{print $2}' | awk -F'[ .]+' '{print $ ...

  9. CENTOS 7 内网网段在用IP地址检测Shell脚本优化版

    脚本内容 #!/bin/bash ############################################################################# # 用途: ...

随机推荐

  1. 深层次揭示runBlocking与coroutineScope之间的异同点

    在之前https://www.cnblogs.com/webor2006/p/11731763.html咱们写过这样的一个例子,先来回顾一下: 也就是来演示runBlocking与coroutineS ...

  2. uiautomator2+python自动化测试2-查看app页面元素利器weditor

    前言 android sdk里面自带的uiautomatorviewer.bat可以查看手机app上的元素,但是不太好用,网上找了个大牛写的weditor,试用了下还是蛮不错的 python环境:3. ...

  3. Python 通过lxml 解析html页面自动组合xpath实例

    #coding:utf-8 ''' @author: li.liu ''' from selenium import webdriver from selenium.webdriver.common. ...

  4. 项目Alpha冲刺--8/10

    项目Alpha冲刺--8/10 作业要求 这个作业属于哪个课程 软件工程1916-W(福州大学) 这个作业要求在哪里 项目Alpha冲刺 团队名称 基于云的胜利冲锋队 项目名称 云评:高校学生成绩综合 ...

  5. keyword (this and arguments) in function --- 涉及递归

    arguments 就像一个数组一样,包含了传递给这个函数的参数 , 以上部分为this的介绍,注意arguments.callee  属性 ,可用于递归调用,其代表的是  : 当前正在运行函数的引用 ...

  6. 利用Python绘制一个正方形螺旋线

    1 安装turtle Python2安装命令: pip install turtule Python3安装命令: pip3 install turtle 因为turtle库主要是在Python2中使用 ...

  7. JQuery系列(4) - AJAX方法

    jQuery对象上面还定义了Ajax方法($.ajax()),用来处理Ajax操作.调用该方法后,浏览器就会向服务器发出一个HTTP请求. $.ajax方法 $.ajax()的用法主要有两种. $.a ...

  8. 查看mysql执行时间

    mysql的 profiling不是默认打开的 查看profiling是否找开 mysql> show variables like "%pro%"; +---------- ...

  9. “Another git process seems to be running in this repository...”Git此问题解决

    Git中显示:Another git process seems to be running in this repository, e.g.an editor opened by 'git comm ...

  10. modbus-poll和modbus-slave工具的学习使用——modbus协议功能码1的解析

    一.数据解析 上一文介绍了modbus工具的基本使用情况,但是还没用说明modbus中的协议的具体意义, 1.左边是slave,id=1,说明地址是1,f=01说明是功能码01,功能码是一个字节,说明 ...