一, 创建.gitlab-ci.yml文件
架构流程
文件内容
stages: #设置流水线模版- build # 编译- source2img- deploy # 发布variables: # 设置全局变量MAVEN_PATH: .m2MAVEM_IMAGE: maven:3.8.5-openjdk-17-slim # maven 打包使用的镜像MAVEN_CLI_OPTS: "-s $MAVEN_PATH/settings.xml --batch-mode"MAVEN_OPTS: "-Dmaven.repo.local=$MAVEN_PATH/repository"IMAGE: shuinfo-docker-images-registry.cn-shanghai.cr.aliyuncs.com/jbs/ods-poc:${CI_PIPELINE_IID}KUBECONFIG: /root/.kube/configcache: # 设置缓存paths:- $MAVEN_PATH/repository/- target/build:# needs:# - check-style# - unit-test# - static-checkartifacts:paths:- starbucks-ods-webflux-poc/target/*.jarexpire_in: 1 weekstage: buildimage: "$MAVEM_IMAGE"before_script:- mkdir -p $MAVEN_PATH- echo $SETTING > $MAVEN_PATH/settings.xmlscript:- mvn $MAVEN_CLI_OPTS clean install package -Dmaven.test.skip=trueonly:- "/^develop/.*$/"- develop- release- "/^release/.*$/"- mastersource2img:stage: source2imgimage: sp0cket/kaniko-executor:debugbefore_script:- echo $DOCKER_AUTH_CONFIG > /kaniko/.docker/config.jsonscript:- ls- pwd- echo $DOCKER_AUTH_CONFIG- echo ${IMAGE}- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $IMAGEonly:- /^develop/.*$/- develop- release- /^release/.*$/- masterdeploy:prod:needs:- source2imgstage: deployimage: sp0cket/kubectl:v1.20.4when: manualbefore_script:- mkdir -p /root/.kube- echo $ODS_SHUINFO_ACK- echo "$ODS_SHUINFO_ACK" > $KUBECONFIGscript:- envsubst '${IMAGE}' < deployment_prod.yaml > dp.yaml- kubectl apply -f ./dp.yaml -n default --insecure-skip-tls-verifyonly:- masterdeploy:test:needs:- source2imgstage: deployimage: sp0cket/kubectl:v1.20.4before_script:- mkdir -p /root/.kube- echo ${ODS_SHUINFO_ACK}- echo "$ODS_SHUINFO_ACK" > $KUBECONFIGscript:- envsubst '${IMAGE}' < deployment_test.yaml > dp.yaml- kubectl apply -f ./dp.yaml -n default --insecure-skip-tls-verifyonly:- /^release/.*$/- releasedeploy:uat:needs:- source2imgstage: deployimage: sp0cket/kubectl:v1.20.4when: manualbefore_script:- mkdir -p /root/.kube- echo ${ODS_SHUINFO_ACK}- echo "$ODS_SHUINFO_ACK" > $KUBECONFIGscript:- envsubst '${IMAGE}' < deployment_uat.yaml > dp.yaml- kubectl apply -f ./dp.yaml -n default --insecure-skip-tls-verifyonly:- /^release/.*$/- releasedeploy:dev:needs:- source2imgstage: deployimage: sp0cket/kubectl:v1.20.4artifacts:paths:- starbucks-ods-webflux-poc/expire_in: 1 weekbefore_script:- mkdir -p /root/.kube- echo "$ODS_SHUINFO_ACK" > $KUBECONFIGscript:- envsubst '${IMAGE}' < deployment_dev.yaml > dp.yaml- kubectl apply -f ./dp.yaml -n default --insecure-skip-tls-verifyonly:- develop- /^develop/.*$/
二, 创建Dockerfile文件
文件内容
FROM eclipse-temurin:17-jreADD ./target/ods-poc-0.0.1-SNAPSHOT.jar /home/app/app.jarWORKDIR /home/appENV TZ Asia/ShanghaiENTRYPOINT ["java","-jar","/home/app/app.jar"]EXPOSE 8083
三, 创建deployment_dev.yaml文件
文件内容
apiVersion: apps/v1kind: Deploymentmetadata:name: starbucks-ods-webflux-poclabels:app: ods-pocspec:replicas: 1selector:matchLabels:app: starbucks-ods-webflux-poctemplate:metadata:labels:app: starbucks-ods-webflux-pocspec:imagePullSecrets:- name: repo-keynodeSelector:app: "app"containers:- name: starbucks-ods-webflux-pocimage: ${IMAGE}resources:limits: # 限制资源大小memory: "4096Mi"cpu: "2"ports:- containerPort: 8083env:- name: "JAVAAGENT_OPS"value: ""- name: "spring.profiles.active"value: "dev"# - name: "loader.path"# value: "/home/app/lib"---apiVersion: v1kind: Servicemetadata:name: starbucks-ods-webflux-poc-svclabels:app: ods-pocspec:ports:- name: apiport: 8083protocol: TCPtargetPort: 8083selector:app: starbucks-ods-webflux-poc
四, gitlab设置项目受保护分支
settings -> Repository -> Protected branches -> expand
进行设置需要发布的分支为受保护分支
五, 设置全局变量
设置settings.xml
<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><mirrors><mirror><id>mirror</id><mirrorOf>central,jcenter,!rdc-releases,!rdc-snapshots</mirrorOf><name>mirror</name><url>https://maven.aliyun.com/nexus/content/groups/public</url></mirror></mirrors><servers><server><id>rdc-releases</id><username>619c5ce2ebd22e300e389f29</username><password>NMSPLZC03=66</password></server><server><id>rdc-snapshots</id><username>619c5ce2ebd22e300e389f29</username><password>NMSPLZC03=66</password></server></servers><profiles><profile><id>rdc</id><properties><altReleaseDeploymentRepository>rdc-releases::default::https://packages.aliyun.com/maven/repository/2178480-release-UPz05J/</altReleaseDeploymentRepository><altSnapshotDeploymentRepository>rdc-snapshots::default::https://packages.aliyun.com/maven/repository/2178480-snapshot-AVBxKP/</altSnapshotDeploymentRepository></properties><repositories><repository><id>central</id><url>https://maven.aliyun.com/nexus/content/groups/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository><repository><id>snapshots</id><url>https://maven.aliyun.com/nexus/content/groups/public</url><releases><enabled>false</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>rdc-releases</id><url>https://packages.aliyun.com/maven/repository/2178480-release-UPz05J/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository><repository><id>rdc-snapshots</id><url>https://packages.aliyun.com/maven/repository/2178480-snapshot-AVBxKP/</url><releases><enabled>false</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>https://maven.aliyun.com/nexus/content/groups/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository><pluginRepository><id>snapshots</id><url>https://maven.aliyun.com/nexus/content/groups/public</url><releases><enabled>false</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>rdc-releases</id><url>https://packages.aliyun.com/maven/repository/2178480-release-UPz05J/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository><pluginRepository><id>rdc-snapshots</id><url>https://packages.aliyun.com/maven/repository/2178480-snapshot-AVBxKP/</url><releases><enabled>false</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles><activeProfiles><activeProfile>rdc</activeProfile></activeProfiles></settings>
设置kubeconfig
apiVersion: v1clusters:cluster:server: https://172.16.101.130:6443certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURUakNDQWphZ0F3SUJBZ0lVUU12OFpEUXJ6MXpPdzJhSzZjYjBrVnIrZThRd0RRWUpLb1pJaHZjTkFRRUwKQlFBd1BqRW5NQThHQTFVRUNoTUlhR0Z1WjNwb2IzVXdGQVlEVlFRS0V3MWhiR2xpWVdKaElHTnNiM1ZrTVJNdwpFUVlEVlFRREV3cHJkV0psY201bGRHVnpNQ0FYRFRJeU1EUXhOREEwTXpFd01Gb1lEekl3TlRJd05EQTJNRFF6Ck1UQXdXakErTVNjd0R3WURWUVFLRXdob1lXNW5lbWh2ZFRBVUJnTlZCQW9URFdGc2FXSmhZbUVnWTJ4dmRXUXgKRXpBUkJnTlZCQU1UQ210MVltVnlibVYwWlhNd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFSwpBb0lCQVFDenVIZ1M1eExOY0gyVDJJYW50WVNXRWlETG1HSG9YREttSFNLeVBXTFgreVJWblVYZDRsaFNTSGYrCjNNSzRMb2dTNTNHd01hUlNyVExlbjVzdVhoNUFUemZTQ013ckRzUzBHNUFST0l3UGU3Y0xTWXQ2RXFwUWhpUksKc0h2cFFZSTl3cFpTL2Q5MG9zRTRzWnlvT0EzM2oxOGdmcWVEMERINGdRV2ExaWJwaHJheVptVWpidUZDUmxTdgpjMG5ORFVyMUdsVlJURkRwaHpsVUgxT0VadUt3ZjBLamlPZEp5ZXJJN1R2OFBjaEtOTlczV0NGQ0Z4c0F1UGswCkJaUE9NbXJaZXBHMjlLbWlCYUY3ZFJ0WGRBelJldmdLZU9nNDh0TktoUU50ZXBhT3ZyeUZpd0p0YXhlNUl5cGsKMnNDcGZQT0M0U1p2bHFRK1c3T1VJWkF1K3oycEFnTUJBQUdqUWpCQU1BNEdBMVVkRHdFQi93UUVBd0lDckRBUApCZ05WSFJNQkFmOEVCVEFEQVFIL01CMEdBMVVkRGdRV0JCVHFPYVFmM1Zud0F5WG82Ti8vaGhWQzF4czZTVEFOCkJna3Foa2lHOXcwQkFRc0ZBQU9DQVFFQWxTSWlHUUhnc3RWb2JIZFI3MTkxTE1GSGZnRFljcm5KdVljNVY4RE4KTGp1SzZ2dmhJQTJFbUc5YmYxZWtCaktqNTZzNWs3dGNKeVhhYWUxTEFLbVk1dGMwY0lUNW1OYWdaNmhWbEdUbAozU3Zwc0NEQUF0dUc1WVZJL2JSRTBhYVQzcm9WaGNiS0prcUxPM0V2bkoxR1NRd2lrMzcwK3N2QWdlTElrWU15Cno3ekJoVlBzUldOWG56dkVJR0NEYk9VL01OdW5lQWxrdnlOM29nVkF2MTlhcjNFb2ZvTEJkUjRXUnVyYVZJVDMKQ1J2OTBUdlZIU0VOc3NkM1YyYStabE9zRjg1WVkxelpURHIrTFlZN2NVUHQzV29kd1JKdWRRU2VoWWZDdklRZQpGdjZTMHFjSkpoNlZWUm5xT2JYWlk0VFZNRFpSR0MyenlFUXdlQ0NTQzd0b0hRPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=name: kubernetescontexts:context:cluster: kubernetesuser: "222275036955515715"name: 222275036955515715-ccf933127c22540f9a1b59e3f24ab8e9dcurrent-context: 222275036955515715-ccf933127c22540f9a1b59e3f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2UvUkNoK21NOWlKUUdpYlg0UUpqVWEzeFZ0TENuVDdreXoxZFZ1NTNlMVF5Sk0xaFRiMUNLdmNhYjlGOQowSE16ZWs1KzZrVWVVU3RVbjR4bW9GNkdJS0JERHRpVEFDL2txNnBmbExGbHFZSzhpaE5ETG0vWG5HOWgrallDCnFldTcyT2lxSGkxUHU4cDQ1SHV4QVFLQmdDUDRFY1ZKZGZRV040NWtDZGNYSDRQUng2dVlFSUtpNGxPMVk3cnEKS0xWYkw2S1FTRUlYQzYzcWFLRWFleWM3N2hLSDgreHR2aWNQamgrZWNqMzYydmt2aWNyK3FjclBHeitjd2p1aQpkTXBkZUQrUGMyRFYvUEdwVFlBQXd3eWxUaEkweUYzSDc4SmE0SjVOYklPUGJUM2tacFpQMzgweUxjOGdLNzJJCjcxOGhBb0dBYTd2RjFVUXRmZEt0SHBTRkppejRWSVRYY1BOcjhMYy9xc2F4NEwvV1paaWw3YWpRL1VWTEZ1YVMKWk1WU2VtK3ZzY1pGWUFmNGtEdENCeTlWZXRyMnRvdW5EVUYyRHhlTDBnWFpQWEUzeCtFVlVTbEVzQ3NIN1JLMQppK1NIYmVwMFZZRFFFZ3o2Ukx3K2JReTIvUXZiZlFkcms5U2ZFK2VTTlQrT2sveDdzVkU9Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
六, 绑定域名
对于需要供外部服务或客户端访问的系统一般需要配置绑定域名,即需要在Ingress中绑定
文件内容
apiVersion: networking.k8s.io/v1kind: Ingressmetadata:name: ingress-nginxnamespace: defaultuid: 136b1e73-f3ca-469c-b710-914807bc1162resourceVersion: '13945489'generation: 1creationTimestamp: '2022-04-19T05:10:25Z'annotations:nginx.ingress.kubernetes.io/service-weight: ''managedFields:- manager: ACK-Console Apache-HttpClientoperation: UpdateapiVersion: networking.k8s.io/v1time: '2022-04-19T05:10:25Z'fieldsType: FieldsV1fieldsV1:f:metadata:f:annotations:.: {}f:nginx.ingress.kubernetes.io/service-weight: {}f:spec:f:rules: {}- manager: nginx-ingress-controlleroperation: UpdateapiVersion: networking.k8s.io/v1time: '2022-04-19T05:10:31Z'fieldsType: FieldsV1fieldsV1:f:status:f:loadBalancer:f:ingress: {}selfLink: /apis/networking.k8s.io/v1/namespaces/default/ingresses/ingress-nginxstatus:loadBalancer:ingress:- ip: 172.16.101.133spec:ingressClassName: nginxrules:- host: starbucks-ods.shuinfo.techhttp:paths:- path: /pathType: ImplementationSpecificbackend:service:name: starbucks-ods-webflux-poc-svcport:number: 8083