当前位置: 首页 > news >正文

网站建设800元全包关键词点击排名系统

网站建设800元全包,关键词点击排名系统,优化师,衢州站扩建案例环境说明 示例项目: 代码仓库:https://gitee.com/mageedu/spring-boot-helloWorld.git 构建工具maven pipeline各Task git-clone:克隆项目的源代码 build-to-package: 代码测试,构建和打包 generate-build-id:生…

案例环境说明

  • 示例项目:

    代码仓库:https://gitee.com/mageedu/spring-boot-helloWorld.git

    构建工具maven

  • pipeline各Task

    • git-clone:克隆项目的源代码

    • build-to-package: 代码测试,构建和打包

    • generate-build-id:生成build id

    • image-build-and-push:镜像构建和推送

    • deploy-to-cluster:将新版本的镜像部署到kubernetes集群

  • Workspace

    • 基于PVC,跨task数据共享

在这里插入图片描述

2.2.5.2 pipeline完成Image构建,推送和部署

  1. 01-git-clone的Task

    apiVersion: tekton.dev/v1beta1
    kind: Task
    metadata:name: git-clone
    spec:description: Clone code to the workspaceparams:- name: urltype: stringdescription: git url to clonedefault: ""- name: branchtype: stringdescription: git branch to checkoutdefault: "main"workspaces:- name: sourcedescription: The code repo will clone in the workspacesteps:- name: git-cloneimage: alpine/git:v2.36.1script: git clone -b $(params.branch) -v $(params.url) $(workspaces.source.path)/source
  2. 02–build-to-package.yaml

    apiVersion: tekton.dev/v1beta1
    kind: Task
    metadata:name: build-to-package
    spec:workspaces:- name: sourcedescription: The code repo in the workspacessteps:- name: buildimage: maven:3.8-openjdk-11-slimworkingDir: $(workspaces.source.path)/sourcevolumeMounts:- name: m2mountPath: /root/.m2script: mvn clean install# 定义volume提供maven cache,但是前提得创建出来maven-cache的pvcvolumes:- name: m2persistentVolumeClaim:claimName: maven-cache
    
  3. 03-generate-build-id.yaml

    apiVersion: tekton.dev/v1beta1
    kind: Task
    metadata:name: generate-build-id
    spec:params:- name: versiondescription: The version of the applicationtype: stringresults:- name: datetimedescription: The current date and time- name: buildIddescription: The build IDsteps:- name: generate-datetimeimage: ikubernetes/admin-box:v1.2script: |#!/usr/bin/env bashdatetime=`date +%Y%m%d-%H%M%S`echo -n ${datetime} | tee $(results.datetime.path)- name: generate-buildidimage: ikubernetes/admin-box:v1.2script: |#!/usr/bin/env bashbuildDatetime=`cat $(results.datetime.path)`buildId=$(params.version)-${buildDatetime}echo -n ${buildId} | tee $(results.buildId.path)
  4. 04-build-image-push.yaml

    要想能推送镜像到镜像仓库,必须创建一个secret对象,挂在到kaniko的/kaniko/.docker目录下,具体创建secret的方法有两种:

    1、先在一台机器上login镜像仓库,这里以dockerhub为例,将会把认证文件保存在~/.docker/config.json:
    在这里插入图片描述

  5. 基于config,json创建sectet,这里的secret的类型选择generic

    kubectl create secret generic docker-config --from-file=/root/.docker/config.json
    

    2、先基于user/password创建一个base64:

    echo -n USER:PASSWORD | base64
    

    创建一个config.json,然后将创建出来的base64替换到下面xxxxxxxxxxxxxxx

    {"auths": {"https://index.docker.io/v1/": {"auth": "xxxxxxxxxxxxxxx"}}
    }
    

    最后创建一个secret

    kubectl create secret generic docker-config --from-file=<path to .docker/config.json>
    
  6. 05-deploy-task.yaml

    apiVersion: tekton.dev/v1beta1
    kind: Task
    metadata:name: deploy-using-kubectl
    spec:workspaces:- name: sourcedescription: The git repoparams:- name: deploy-config-filedescription: The path to the yaml file to deploy within the git source- name: image-urldescription: Image name including repository- name: image-tagdescription: Image tagsteps:- name: update-yamlimage: alpine:3.16command: ["sed"]args:- "-i"- "-e"- "s@__IMAGE__@$(params.image-url):$(params.image-tag)@g"- "$(workspaces.source.path)/source/deploy/$(params.deploy-config-file)"- name: run-kubectlimage: lachlanevenson/k8s-kubectlcommand: ["kubectl"]args:- "apply"- "-f"- "$(workspaces.source.path)/source/deploy/$(params.deploy-config-file)"
    
  7. 06-pipelinerun-s2i.yaml

    apiVersion: tekton.dev/v1beta1
    kind: Pipeline
    metadata:name: source-to-image
    spec:params:- name: git-url- name: pathToContextdescription: The path to the build context, used by Kaniko - within the workspacedefault: .- name: image-urldescription: Url of image repository- name: deploy-config-filedescription: The path to the yaml file to deploy within the git sourcedefault: all-in-one.yaml- name: versiondescription: The version of the applicationtype: stringdefault: "v0.10" workspaces:- name: codebase- name: docker-configtasks:- name: git-clonetaskRef:name: git-cloneparams:- name: urlvalue: "$(params.git-url)"workspaces:- name: sourceworkspace: codebase- name: build-to-packagetaskRef:name: build-to-packageworkspaces:- name: sourceworkspace: codebaserunAfter:- git-clone- name: generate-build-idtaskRef:name: generate-build-idparams:- name: versionvalue: "$(params.version)"runAfter:- git-clone- name: image-build-and-pushtaskRef:name: image-build-and-pushparams:- name: image-urlvalue: "$(params.image-url)"- name: image-tagvalue: "$(tasks.generate-build-id.results.buildId)"workspaces:- name: sourceworkspace: codebase- name: dockerconfigworkspace: docker-configrunAfter:- generate-build-id- build-to-package- name: deploy-to-clustertaskRef:name: deploy-using-kubectlworkspaces:- name: sourceworkspace: codebaseparams:- name: deploy-config-filevalue: $(params.deploy-config-file)- name: image-urlvalue: $(params.image-url)- name: image-tagvalue: "$(tasks.generate-build-id.results.buildId)"runAfter:- image-build-and-push
  8. 07-rbac.yaml

    因为06task的容器要执行kubectl,所以,给这个pod要指定一个serviceaccount,这样才能操作集群的资源

    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:name: helloworld-admin
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:name: helloworld-admin
    roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: cluster-admin
    subjects:
    - kind: ServiceAccountname: helloworld-adminnamespace: default
  9. 08-pipelinerun-s2i.yaml

    apiVersion: tekton.dev/v1beta1
    kind: PipelineRun
    metadata:name: s2i-buildid-run-00002
    spec:serviceAccountName: defaulttaskRunSpecs:- pipelineTaskName: deploy-to-clustertaskServiceAccountName: helloworld-adminpipelineRef:name: source-to-imageparams:- name: git-urlvalue: https://gitee.com/mageedu/spring-boot-helloWorld.git- name: image-urlvalue: icloud2native/spring-boot-helloworld- name: versionvalue: v0.1.2workspaces:- name: codebasevolumeClaimTemplate:spec:accessModes:- ReadWriteOnceresources:requests:storage: 1GistorageClassName: nfs-csi- name: docker-configsecret:secretName: docker-config

    运行:

    kubectl apply -f .
    

    结果:

    1. 整个pipeline执行成功
      在这里插入图片描述
      2、image推送到dockerhub
      在这里插入图片描述
      3、查看部署
      在这里插入图片描述
      更多关于tekton文章,后续更新。。。
http://www.hkea.cn/news/349908/

相关文章:

  • 省心的免费建站服务热线四川seo关键词工具
  • 网站总是跳转dede58seo对网络推广的作用是
  • seo排名怎么提高seo排名优化软件有用
  • 江门论坛建站模板黑帽seo联系方式
  • 政府网站信息内容建设专项检查搜索引擎排名优化seo课后题
  • 个人做的好的淘宝客网站软文营销推广
  • 城乡建设委员会网站河北seo推广公司
  • 某网站栏目策划2022十大热点事件及评析
  • 德清网站建设中心优化大师官方免费下载
  • 生日网页制作免费网站制作代做网页设计平台
  • 学校类网站特点游戏优化大师官网
  • 手机电视网站大全河南网站建设定制
  • zblog做的商城网站上海有实力的seo推广咨询
  • 免费网站模板psd网络营销的整体概念
  • 网站模板下载破解版环球军事新闻最新消息
  • 徐汇苏州网站建设东莞免费建站公司
  • 厦门网站建设哪家强深圳网站维护
  • 政府网站新媒体平台建设关键词权重查询
  • 重庆网站建设制作公司百度客服人工在线咨询电话
  • 微信公众号平台入口官网奶盘seo伪原创工具
  • 泉州网站建设公司推荐宁德市地图
  • 大厂县住房和城乡建设局网站刷百度指数
  • 低代码开发平台优缺点昆山seo网站优化软件
  • 网站开发年终总结网络营销战略的内容
  • 建立门户网站的意义营销推广网
  • 网站建设网站软件有哪些百度推广开户费用标准
  • 找家装修公司家装吉林seo外包
  • 保定医疗网站建设公司会计培训班初级费用
  • 最好的销售管理系统seo发帖网站
  • 德州乐陵德州seo公司seo批量建站