構建helm chart應用


  • 使用helm命令創建基礎目錄
helm create t2cp

[root@node04 ~]# tree t2cp
t2cp
├── charts
├── Chart.yaml
├── templates
│   ├── deployment.yaml
│   ├── _helpers.tpl
│   ├── ingress.yaml
│   ├── NOTES.txt
│   ├── service.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml

  • 編輯Chart.yaml 用於描述應用,包括名字,描述信息以及版本
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: t2cp
version: 11
  • 編輯values.yaml設置啟動容器的相關參數
cat values.yaml |grep -v "#"|grep -v ^$
replicaCount: 1
image:
  repository: t2cp/t2cp-dev
  tag: 11
  pullPolicy: IfNotPresent
nameOverride: ""
fullnameOverride: ""
service:
  type: ClusterIP
  port: 9010
ingress:
  enabled: false
  annotations: {}
  paths: []
  hosts:
    - t2cp.local
  tls: []
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
  • 進入t2cp目錄校驗helm chart應用
helm lint
==> Linting .
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, no failures
  • 對t2cp應用打包
helm package t2cp --debug
Successfully packaged chart and saved it to: /root/t2cp-11.tgz
  • 上傳到harbor私有倉庫
helm repo list
NAME    URL                                             
stable  https://kubernetes-charts.storage.googleapis.com
local   http://127.0.0.1:8879/charts                    
bitnami https://charts.bitnami.com/bitnami              
myrepo  https://www.harbor.mobi/chartrepo/myrepo 

helm push /usr/t2cp-0.1.1.tgz myrepo

# 或者在第五步的時候不打包應用,直接上傳目錄
helm push t2cp myrepo

# 需要配置自簽名證書和賬號密碼的操作
helm push --ca-file /usr/local/harbor/cert/ca.crt --cert-file /usr/local/harbor/cert/www.harbor.mobi.cert --key-file /usr/local/harbor/cert/www.harbor.mobi.key --username=admin --password=Harbor12345 t2cp-0.1.1.tgz myrepo


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM