亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

kubernetes實現ci/cd

發布時間:2020-05-27 15:16:01 來源:億速云 閱讀:1147 作者:鴿子 欄目:系統運維

K8S ci/cd三劍客:jenkinsfile、dockerfile、k8s.yaml
k8s的ci/cd實例
jenkins+jenkinsfile+dockerfile+k8s.yaml
1、dockerfile 實例
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

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

spec:
replicas: 1
revisionHistoryLimit: 1
#滾動升級時70s后認為該pod就緒
minReadySeconds: 70
strategy:
##由于replicas為3,則整個升級,pod個數在2-4個之間
rollingUpdate:
#滾動升級時會先啟動1個pod    
maxSurge: 1
#滾動升級時允許的最大Unavailable的pod個數
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實例

pipeline {
agent {
label 'master'
}
parameters {
string(name: "branch", defaultValue: "master", description: "code branch")      
extendedChoice(
defaultValue: '',
description: '選擇發布模塊',
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                
'''
}          
}      
}
}

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

镇沅| 临汾市| 淳化县| 承德县| 尚义县| 新余市| 伊川县| 包头市| 凤庆县| 乳源| 沂水县| 高尔夫| 闽清县| 贡觉县| 侯马市| 湘潭市| 马边| 乌拉特中旗| 浪卡子县| 敦化市| 丹江口市| 盈江县| 澜沧| 杭锦旗| 扬州市| 浙江省| 阳泉市| 梨树县| 井陉县| 桦甸市| 彰化县| 深水埗区| 元朗区| 合阳县| 扶沟县| 通许县| 乌拉特后旗| 新巴尔虎左旗| 武清区| 万宁市| 延寿县|