Kubernetes集群使用Jenkins持续发布

所需积分/C币:47 2018-06-13 10:45:32 868KB PDF
收藏 收藏
举报

Kubernetes集群使用Jenkins持续发布,企业级应用相关运维部署
专 全局安全配置 加ante 启用 用户认证勾选 填服务器地址 填 服务器地址 填上一步服务器生成的 Application Id 填上一步 报务器生成的 Secret 授权策略:登录用户可以做任何事 保存, jenkins首页点登录,珧转gtlb用户登录,输入 gitlab用户名密码,然后显示以下页 面 他 o Gstl ab Fro Groupn ArtiMitr Milotonn snippet A profile Authorize jenkins ta use your account? "i: Appkcabons A起akNn学品y6 LrGtsbscesart Passs nsw ths! this Mppieatan 8 not prewidd by sitab and yau shouid sory it teviot before a owing pocess. dv+nP句 a Email 问 P ssn seye 点 Authorize登录进入 jenkins Jenkins使用 kubernetes集群创建pod作为 slave 系统管理≯系统设置→云→新增一个云选 Kubernetes ngns Kubemetc server certficate MeY Cisable hllps certificate check Kuberneles Namespace 33163242-D545-4eas-aDcs-DcA83aC4sls (terete entia accunt)v-At stC⊙e Jenkins URL hp的nkn出eas此电 she west BECO Jenkins tunnel Connected TifteOUl RE TEAU Mar mnfirrinns to Wibernele 4F 3 填 填 填 填 这个 然后测试连接 填 创建 Jen kins slave的 kubernetes pod模板 Defaurs proper temn e name KuNeMMA Pad Tet15t'A Name 限可的用个世 the name of the pod temple t inher fram 知bnMa 是 -meand to nn kae cam sk数湖的始 把团m 叫 只具ps的moh RHUMLCP 填 填 填 填 填 填 清空 填 高级里面 勾选特权模式运行 项目发布流程 1.开发人员运行 Git push提交代码到gtab代码库 2.Gitb的 web hook触发 jenkins构建任务 3. Jenkins master使用 kubernetes集群创建 jenkins slave 4. jenkins slave根据构建任务定义执行动作 从 gitlab代码库下载项目代码,根捃 Dockerfile定义制作 docker镜像,上传 docker镜像到 私有仓库 registry,根据模板生成 kubernetes配置文件,最后部署镜像到 kubernets运行 5.任务完成,使用钉钉机器人发送通知 DeVOPs操作规范与要求 项目代码与服务模板 每个g项目内容如下 ☆ Star yOrk SSHY Global Leave project iles(10.5 MB) Commits(8) Branch (1) Tegs (O)i Add ChargelDgi Add License Add Contribution guide Set up CI master m-web/+ History Q Find而e clean useless files 91b1589b committed about 21 hours ag Name st commit Last update kubarnete hange k&s svc about 22 nours ago www root clean ur class fiiler about 21 hours ago 彐 Dodxertile a month ago Dockerfile:镜像构建文件 kubernetes: kubernetes相关配置文件模板目录 deploy svc pvc等 www root:业务代码目录 以及其他配置文件与脚本(根据需要添加) Jenkins新建构建任务 输入一个任务名称 k项 构建一个自由风格的软件项目 这是」nkns的主要功能 elkins将结合任何SCM和任呵构建系统构你的顶目甚竺冂以杓软悱以外的系 构建一个 maven项目 三nine甜口物罟 选择构建一个自由风格的软件项日 General配置 JEnkins dented理满园通 Pmn叫 ao capg Ar减g 口 Cart Hss <narnia 口要构 口关闭构理 口在心要持构键 Lacet Lrrnesyon 仰e 填写名字和描述 勾选 填jnp-save 限制运行设置标签表达式jnp-save 源码管理 源码管理 O CVs Projuctsel Repository uRL gi@ret Branch Specifier (blank or an"master 游码库器 AddaleneI ThebUD Ad 填写git地址gt@git.example.com/example__web.git 添加gt账户名和ss私钥 构建触发器勾选 c溶理将建林灰环填相建作 构建触发器 口贴发运程使用考 BBuild aer othcr proce dre built 日 Build pcradcalhy 8 日 Build when a chine s pushed to GitLab GlOb Cl Gcmce uraL htp小h Enat eg GaLab trigers push everts Dpcneu vanc8uetE论 ACCeDed warpe只EvE ed Nerge Request目ens oMMEN Comment regex r cenac a bull: Jetkirs pease rry a btM Enate le-skip 的 noNe WP Merge Requests Ber band aesanpton to build cause (en Merge requestor 3 Push) L Duid on suconnsTul pipeline rue as Awed branches .o Ae al branches to tigger this o s Ohler Branches by raTe C Finer brandes by regex SEcret token 记下触发器地址和生成的 Secret token Gtab项目内设置 web hook 项目名→ Settings≯ tegration d GitLab Priest v Group Ativity Malealonss sport Integrations G Re a Realty 0地用d64 Itune Je ae lekhs to vases remi dyes f wall be sint with the request in the X.caitlab. loken HTlP hesder EI/CD The Vi.Yil bs rigged ty a vah te the weemaitery □ Tag puc oven □ Comment Tha[词B数eaw是nns品 updated/merged 口 Me ye feest aunts The Lil wa bs angered wten a mena rmquaaf i created/upo Iw智w是情hs内 the VIL ya b waerd wtan the spins status wange 填写 Jenkins生成的触发器地址和 Secret token 构建增加构建步骤 Docker build and publish 构建 IBCwalonY Nanne HGUILU NUMBER Serer credential Docker reg sty URL ntps /registry. cn-acging altyuncs cowra Registry credentials 间帮云器像亭孙》y·品梦 DlK口B生 ceA5 Main LSOLSICRU色5L2界s创心,数射时时瓶R边s Client Cenfcae: Daa LS0t51CRuJTBDRVJUS S)KKL SURy/END035X20"3SLLBzODUM VdNT'SiFSiITMSTUEWRONTCUITSWZ Glint Hwy Eaa sGRKBsEcFNRsRMt30t.ptalaFB30rBUMEeBTumowvowocNasehwoN糖 F记5 web-tpay yml kuberrees wasat yml Enable Varab substitution in conmg p Dock ConNes Regiatry Credentials /Rubzernets secet weary Conn gunston 填写镜像名称 Tag填写镜像标签本例使用${ BUILD NUMBER}构建号码作为tag 填私有仓库地址 设置私有仓库用户名密码 Deploy to kubernetes 填写k8s凭证包括地址证书,复制 kubectl控制用户~/ kubectl/config相关字段 填写项目内 kubernetes配置文件路径逗号分隔 勾选允许变量替换 构建后操作 钉钉电脑客户端一钉钉群一群设置一群机器人一添加群机器人一自定义 设置 编前头像 机端人名字 enkins3ot 接收群组 技术部 消息推送: 开启 webhook https://oapi.d-ngtalk.com/robot/send复制重置 取消 完成 记下 access token jenkins增加构建后操作步骤≯钉钉通知器配置 建后擇作 钉钉遇知器配 jenkins URL httpijenans 们灯 aecHs Iven 在启动构速时知日 成时遇知日 国后操挡值 填 钉钉 填写生成的 access token字串 勾选相应的通知选项 演示任务构建控制台输出 16: 11: 3785d83+ b18: Layer already exists 16: 11: 37 73b4603e66e8: Layer already exist 16: 11: 3/ eebd293db08T: Layer already exists 16: 11: 37 3efd1f7c01+6: Layer already exists 16: 11: 37 58bcc73uL f40: Layer alreauy exisl 16:11:379dc1881975+d: Layer ady exist 16:11:371 atest: digest:sha256:352465ba661f95d9989b0982162788e9d9906674 eadF252b627721dsiz:4097 16: 11: 38 Loading configuration: /hone/jenkins/works pace/web/kubernetes/imms web-ceplay yml 16: 11: 4E Applied DeploynenL: Deploymen l(apiver'siun=exLensiurs/v1beLdl, kind=Depluynel-, ne laua Ld=Ob je LMela(erniulaliu'15= lusTer N-ine=Hull, cr additional Dropontias-4]), de lotinnGracoDeriodsecnnds-nui1, celotinnTi mest amp-nmll, finalizpnc-[], epnanatpName-nlll, goneratior-4, initializers add pacc-dcfault, owncrRcfcrcnccs-], rcsourccVcrsion-3670247, sclfLink-japis/extensions/vlbcta1namespaces/default/deployments/m itioralproperties= pec=Deploymentspec(mdnReadyseconcs=null, paused=null, progressDeaclineseconds=null, replicas=l, revisionHistoryLimit=nul nmatchExpressions=l], matchLabels=fapp= additicnalproparties=0), stratagy=Deplcymentstrategy (rolling Ro-lingupdateDeployment(m StrVal=rull, additionalProperties=ft), naxUnavailable=Intorstring(IntVal=1, Kind=null, StrVal=null, additionalfroperties= L template=PodTemp-atesrec(metadata=0bjectMeta( annotations=null, clusterName=null, creaticnTimestamp=null, deletionGracepericdseconds=null, dele gencratcNamc-null, gcncroticn-null, initiolizcrs-null, labcls-app-t wcb), nam2-nul-, rarespace-dcfault, CrnerRefcrences-[l, rcsourceversicn additioralpropertles=]), spec=podSpec(activeDeadlineseconcs=null, affinity=null, automountserviceAccounttoker=null, containers[Container args=[] vaiue-test, valueFrom-null, additionalproperties-D)], env Frcm-l, image-registry, cn-beijEng. aliyuncs con gepullpolicy (exec=ntll,failurethreshold=5,httpget=httpgetaCtion(host=rull,httoheaders=fl,pati=,,port=intorstringdintVal=80,Kind=null,Strval=nulL,additi additioralpropenties=J, initialDelay Seconds=60, periodSeconds=10, successThreshold=l, topsocket=null, tinmeoutseconds=5, additionalProperties=t) (contaircrport-80,hostir-null,hostport-null,nanc-http,prctocol-tcp,additionalpropertics-o)],rcadincssprcbc-probcexcc-null,failurcth E.palf=/,wurl=inllorSlring(iNlval=80,kiNd=rull,SlrvAl=null,auuilindlpruperLies=0,schee=http,auuiliundlprupeRties=f),inilialdelaySecurid - Socket=null, timeoutseccnds=5, additionalProperties=t), resources=ResourceRequiraments(limits=cpJ=Quantity(amount=500n, tormat=null, additicna ormat-rull, additionalProperties-0, requests-cpu-Quantity (amount-50m, fcrmat-null, additicnalProperties-0), memory-Quantity(amount-64Mi, form additioralpmpenties=]), security ontext=nl, stdin=null, stdin: )nrP=null, terminationMessagepath=/dev/Termiration-loe, terminationMP5sagApol icy=H additioralpropentics-])], dnsrolicy-ClusterFirst, hostAlioscs-[], nos-INC-rull, hostNetwork-rull, hostPID-null, hostnamc-null, imagcpull iLiur dlPruper Lies=)], iruiLCunLdiners=[]. nuueName=null, rude. or=full, r'esLarLPo-icy=Always, scheduler Name=uefaull-scheduler ⊥ LyCan runAsNor Root=null, runAsUser=null, seLinuxoptions=null, supplementalGroups=l, additionaIProperties=0), serviceAccount=nu._, serviceArcountNane=nu erminationGracePeriodsecords-Ge, tolerations-Ll, volunes-[], additionalProperties-()), additicnalProperties-0), additionalPreperties-O), status 01isicn( nunt=null, conditions=[)Ppi(ondition(last iransitinnI i me=lime(time=/A1X-01-WXIEih: 16: 4//, additicnalprnnerties=0), lastlndarel ie=l odditioralnropentics-), mcssagc-Deploymcnt has minimun availability, rcoscn-MininimRep-iccsAvoilablc, status-Truc, typc-Availablc, additionalrro eddyReplicds=l, replicas=l, urldvdilableReplicds=null, upualedRepliLds=l, dcuiLiurldIr'operLies=f, aduiLionaIPruper Lies=f) 16: 11: 4F I oading ronT-guration: /home/jenkins/workspace/B ph/<lhernetes/ weh-cvc-yml 16: 11: 4E Applied Service: Service (apiVersion-v1, kind-Service, metadata-objectMeta(annotatiors-null, clusterName-null, creation Timestamp-Time(time deietiorGraceperlodseconds=null, deletionTimestamp =null, finalizers=[]. generateName=null, gereration=null, initializers=null, labels=null, name=wh cEVersion-3670267,selfLink-/api/v1/namespaces/default/services/d-web, uid-feiidasc-dcoc-11e7-9bc7-00163e03C313,additionalproperties-( kNuxlepu protocol=I(P, tareerport=lrtorstring(intval null, strval=nill, additional propert: es=0), arditinna lprcnertip5=)l: selector=app=yr additioralProperties-1), status-Servicestatus(loadDalancer-LoadDalancerstatus(ingress-[], acditionalProperties-0), additionalProperties-fl), addi 10:11: -e Finished Kubernetes deployment 16: 11: /c Finished: sUccESS 演示钉钉群构建通知截图

...展开详情
试读 11P Kubernetes集群使用Jenkins持续发布
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    抢沙发
    一个资源只可评论一次,评论内容不能少于5个字
    关注 私信 TA的资源
    上传资源赚积分,得勋章
    最新推荐
    Kubernetes集群使用Jenkins持续发布 47积分/C币 立即下载
    1/11
    Kubernetes集群使用Jenkins持续发布第1页
    Kubernetes集群使用Jenkins持续发布第2页
    Kubernetes集群使用Jenkins持续发布第3页
    Kubernetes集群使用Jenkins持续发布第4页

    试读已结束,剩余7页未读...

    47积分/C币 立即下载 >