Jenkin部署helm

一、完成语法步骤

pipeline {
    agent any

    stages {
        stage('Pull GitLab') {
            steps {
                checkout scmGit(branches: [[name: '$tag']], extensions: [], userRemoteConfigs: [[url: 'http://192.168.72.110/root/huahua-project']])
            }
        }
        stage('Maven Build') {
            steps {
                sh '/usr/local/maven/bin/mvn package'
            }
        }
        stage('Pull Harbor') {
            steps {
                sshPublisher(publishers: [sshPublisherDesc(configName: 'target15', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: 'target', sourceFiles: 'target/*.jar'), sshTransfer(cleanRemote: false, excludes: '', execCommand: '''docker build -t 192.168.72.15:80/public/huahua:$tag /usr/local/docker
docker login -u admin -p Harbor12345 192.168.72.15:80
docker push 192.168.72.15:80/public/huahua:$tag'
'', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: 'docker', sourceFiles: 'docker/*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
            }
        }
        stage('Helm Build') {
            steps {
                sshPublisher(publishers: [sshPublisherDesc(configName: 'target14', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''helm uninstall huahua
helm repo update
helm install huahua myrepo/huahua-charts --set tag=$tag --set replicas=$replicas
''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
            }
        }
    }
}
 

 二、helm下载

Tags · helm/helm · GitHubThe Kubernetes Package Manager. Contribute to helm/helm development by creating an account on GitHub.https://github.com/helm/helm/tagsmv -f linux-amd64/helm /usr/bin

helm仓库官网:Artifact Hub

举个安装例子:

 卸载:helm uninstall my-replease

三、helm私库

安装chartmuseum(192.168.72.112:8080)

下载地址:Tags · helm/chartmuseum · GitHubHost your own Helm Chart Repository. Contribute to helm/chartmuseum development by creating an account on GitHub.https://github.com/helm/chartmuseum/tags

 容器搭建chartmuseum

前置条件:

四、创建

helm create huahua-charts

修改创建模板目录下的value.yaml 

清空templates文件夹,然后创建huahua-deployment.yml,huahua-service.yml 

修改 Chart.yaml里面的版本号

 

value.yaml

打包:

helm package .

上传:

curl --data-binary "@huahua-charts-1.0.1.tgz"  http://192.168.72.112:8080/api/charts(chartmuseum私服)

安装:

helm uninstall huahua

kubectl delete deployment huahua-deployment

kubectl delete service huahua-service

helm repo add myrepo http://192.168.72.112:8080

helm repo update

helm search repo myrepo

helm install huahua myrepo/huahua-charts

helm list

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值