In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
K8S ci/cd three Musketeers: jenkinsfile, dockerfile, k8s.yaml
Ci/cd instance of K8s
Jenkins+jenkinsfile+dockerfile+k8s.yaml
1. Dockerfile instance
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 axix / usr/bin/run.sh
WORKDIR / app/
CMD run.sh
2. K8s.yaml instance
ApiVersion: apps/v1beta2
Kind: Deployment
Metadata:
Name: yryd-client
Namespace: default
Labels:
K8s-app: yryd-client
Spec:
Replicas: 1
RevisionHistoryLimit: 1
# the pod is considered ready after 70 seconds of rolling upgrade
MinReadySeconds: 70
Strategy:
# # since the replicas is 3, the number of pod for the whole upgrade is between 2 and 4
RollingUpdate:
# 1 pod will be started first when rolling upgrade
MaxSurge: 1
# maximum number of pod of Unavailable allowed during rolling upgrade
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-
Ports:
# Port of the container containerPort: 5001
Name: yryd-client
Protocol: TCP
Env:name: JVMSIZE
Value:-Xms1G-Xmx1Gname: 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:
# Port of cluster IP
Port: 5001
Name: yryd-client
Protocol: TCP
# Port of the container
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 instance
Pipeline {
Agent {
Label 'master'
}
Parameters {
String (name: "branch", defaultValue: "master", description: "code branch")
ExtendedChoice (
DefaultValue:''
Description: 'select release module'
MultiSelectDelimiter:',
Name: 'module'
QuoteValue: false
SaveJSONParameterToFile: false
Type: 'PT_CHECKBOX'
Value:'yryd-client'
VisibleItemCount: 10)
}
Options {
SkipDefaultCheckout (true)
BuildDiscarder (logRotator (daysToKeepStr: '5percent, numToKeepStr:' 8'))
}
Stages {
Stage ('get code') {
Steps {
Git branch:'$branch', credentialsId: 'dd93cf17-ab6c-48e4-9acamurb063d05a031bcm, url:' http://git.bqjr.club/MMT-YRYD/mmt-yryd.git'
}
}
Stage ('yryd-client') {
When {
Expression {return "$params.module" .requests ('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 "samp ${BUILD_NUMBER} / g" k8s.yaml
Kubectl apply-f k8s.yaml-- record
''
}
}
}
}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.