中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

kubernetes實(shí)現(xiàn)ci/cd

K8S ci/cd三劍客:jenkinsfile、dockerfile、k8s.yaml
k8s的ci/cd實(shí)例
jenkins+jenkinsfile+dockerfile+k8s.yaml
1、dockerfile 實(shí)例
FROM harbor.k8s.site/library/jdk/jre:1.8-apline
ENV TZ=Asia/Shanghai
VOLUME /tmp
ADD build/libs/*.jar /app/app.jar
RUN mkdir /logs/ && echo 'java ${JVMSIZE} ${EUREKA} ${LOGPATH}  ${APOLLO} -jar app.jar' > /usr/bin/run.sh;chmod a+x /usr/bin/run.sh
WORKDIR /app/
CMD run.sh

創(chuàng)新互聯(lián)建站堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都做網(wǎng)站、網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿(mǎn)足客戶(hù)于互聯(lián)網(wǎng)時(shí)代的泗水網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

2、k8s.yaml 實(shí)例
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: yryd-client
namespace: default
labels:
k8s-app: yryd-client

spec:
replicas: 1
revisionHistoryLimit: 1
#滾動(dòng)升級(jí)時(shí)70s后認(rèn)為該pod就緒
minReadySeconds: 70
strategy:
##由于replicas為3,則整個(gè)升級(jí),pod個(gè)數(shù)在2-4個(gè)之間
rollingUpdate:
#滾動(dòng)升級(jí)時(shí)會(huì)先啟動(dòng)1個(gè)pod    
maxSurge: 1
#滾動(dòng)升級(jí)時(shí)允許的最大Unavailable的pod個(gè)數(shù)
maxUnavailable: 1  
selector:
matchLabels:
k8s-app: yryd-client
template:
metadata:
labels:
k8s-app: yryd-client
spec:
containers:

  • name: yryd-client
    image: harbor.k8s..site/yryd/yryd-client:build-<BUILD_TAG>
    ports:
    #容器的端口
    • containerPort: 5001
      name: yryd-client
      protocol: TCP
      env:
    • name: JVMSIZE
      value: -Xms1G -Xmx1G
    • name: LOGPATH
      value: -Dlogging.path=/logs/yryd/yryd-client/

      apiVersion: v1
      kind: Service
      metadata:
      name: yryd-client
      namespace: default
      labels:
      k8s-app: yryd-client
      spec:
      ports:
      #集群IP的端口

      • port: 5001
        name: yryd-client
        protocol: TCP
        #容器的端口
        targetPort: 5001
        selector:
        k8s-app: yryd-client

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: yryd-client
namespace: default
spec:
rules:

  • host: yryd-client.k8s..site
    http:
    paths:
    • backend:
      serviceName: yryd-client
      servicePort: 5001

3、jenkinsfile實(shí)例

pipeline {
agent {
label 'master'
}
parameters {
string(name: "branch", defaultValue: "master", description: "code branch")      
extendedChoice(
defaultValue: '',
description: '選擇發(fā)布模塊',
multiSelectDelimiter: ',',
name: 'module',
quoteValue: false,
saveJSONParameterToFile: false,
type: 'PT_CHECKBOX',
value:'yryd-client',
visibleItemCount: 10)      
}  
options {
skipDefaultCheckout(true)
buildDiscarder(logRotator(daysToKeepStr: '5', numToKeepStr: '8'))
}
stages{  
stage('get code'){
steps{
git branch: '$branch', credentialsId: 'dd93cf17-ab6c-48e4-9aca-b063d05a031b', url: 'http://git.bqjr.club/MMT-YRYD/mmt-yryd.git'
}
}
stage('yryd-client'){
when {
expression { return "$params.module".contains('yryd-client')}
}
steps {
sh '''
imageName="harbor.k8s.site/yryd/yryd-client:build-${BUILD_NUMBER}"
cd mmt-yryd-client-service/
/opt/software/gradle-4.8/bin/gradle clean excludedev build -x test
docker build -t ${imageName} .
docker push ${imageName}
docker rmi ${imageName}
sed -i "s/<BUILD_TAG>/${BUILD_NUMBER}/g" k8s.yaml
kubectl  apply -f k8s.yaml --record                
'''
}          
}      
}
}

分享標(biāo)題:kubernetes實(shí)現(xiàn)ci/cd
文章轉(zhuǎn)載:http://www.rwnh.cn/article44/igpche.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、服務(wù)器托管ChatGPT、定制開(kāi)發(fā)、企業(yè)建站、定制網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營(yíng)
资阳市| 长武县| 阿合奇县| 晋江市| 晋中市| 河东区| 贵州省| 隆子县| 怀化市| 肥东县| 冷水江市| 河曲县| 阿克陶县| 璧山县| 田东县| 连云港市| 玉山县| 大丰市| 太和县| 泸西县| 龙山县| 南陵县| 隆回县| 兖州市| 吴忠市| 剑阁县| 天气| 敦煌市| 肃宁县| 朝阳县| 太谷县| 高青县| 霍城县| 西宁市| 五原县| 琼结县| 花莲县| 伊吾县| 长兴县| 永胜县| 蚌埠市|