K8s package Management Helm Command Collection
Preface
Three core concepts of helm:
Chart: chart is an installation package, similar to the rpm,deb installation package Reporitory: warehouse, a http server stores Charts packages. After installing helm, Google's official stable repository is configured by default. Release: heml install an instance generated after a chart. A chart generates a release each time it is installed.
There is no direct relationship between release, each release has a revision, corresponding to the version of the release under helm management.
There are four ways to install helm:
Tgz package packaged from repository and helm install stable/mysqlcharts, charts directory extracted from helm install mysql-2.3.tgz from tgz, helm install mysql/ from url, daily use of helm install http://127.0.0.1:8879/charts/mysqlhelm: a life cycle of release
First look for the package, if you want to install mysql,helm search mysql,mysql is a keyword, if this keyword is defined in the chart.yaml file in a chart, it can be searched.
$helm search mysqlNAME CHART VERSION APP VERSION DESCRIPTION stable/mysql 1.3.0 5.7.14 Fast, reliable, scalable And easy to use open-source rel...stable/mysqldump 2.5.0 2.4.1 A Helm chart to help backup MySQL databases using mysqldump stable/prometheus-mysql-exporter 0.5.1 v0.11.0 A Helm chart for prometheus mysql exporter with cloudsqlp...stable/percona 1.1.0 5.7.17 free Fully compatible, enhanced, open source drop-in rep...stable/percona-xtradb-cluster 1.0.0 5.7.19 free, fully compatible, enhanced, open source drop-in rep
View the contents of the installation package, helm inspect-h, helm inspect values only view the exposed custom parameters, or download the installation package directly to the current directory by helm fetch.
$helm inspect values stable/mysql## mysql image version## ref: https://hub.docker.com/r/library/mysql/tags/##image: "mysql" imageTag: "5.7.14" busybox: image: "busybox" tag: "1.29.3" testFramework: image: "dduportal/bats" tag: "0.4.0" # # Specify password for root user#### Default: random 10 character string# mysqlRootPassword: testing Values for custom installation or direct installation of .helm install Use helm template $chartsName to output the resource file of K 8 s with the same parameters as install. Use-- dry-run-- debug to simulate the installation process and print configuration information. Cat config.yamlmariadbUser: user0mariadbDatabase: user0dbEOFhelm install stable/mysql-f configure.yaml-- set service.nodePort=31313# only views the files during the installation process, not the actual installation. Helm install stable/mysql-f configure.yaml-- set service.nodePort=31313-- debug-- dry-run# outputs the yaml file helm template stable/mysql-f configure.yaml-- set service.nodePort=31313 corresponding to K8s to view the installed release Helm ls, you can check release name, revision version, update date, current status, chart version, app version Namespace.$ helm lsNAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACEgilded-mule 6 Wed Jul 17 10:31:33 2019 DEPLOYED minio-2.5.0 RELEASE.2019-05-14T23-57-45Z default hopping-rottweiler 1 Wed Jul 17 10:06:06 2019 FAILED minio-2.5.0 RELEASE.2019-05-14T23-57-45Z default modest-tuatara 1 Wed Jul 17 10:09:30 2019 FAILED qujun-2.5.0 RELEASE.2019-05-14T23-57-45Z default
Check the resource status of the current installation of release, helm status $releaseName.
$helm status gilded-muleLAST DEPLOYED: Wed Jul 17 10:31:33 2019NAMESPACE: defaultSTATUS: DEPLOYEDRESOURCES:== > v1/ConfigMapNAME DATA AGEgilded-mule-minio 1.68mm = > v1/PersistentVolumeClaimNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEgilded-mule-minio Pending 68m = > v1/Pod (related) NAME READY STATUS RESTARTS AGEgilded-mule-minio-84f85fff78-rv6r6 0max 1 Pending 0 68m = > v1/SecretNAME TYPE DATA AGEgilded-mule-minio Opaque 2 68m.
View release details, heml get $releasename, view the corresponding K8s yaml file, helm get manifest $releaseName. View the value.heml get values $releasename customized during installation
$helm get gilded-mule REVISION: 6RELEASED: Wed Jul 17 10:31:33 2019CHART: minio-2.5.0USER-SUPPLIED VALUES:service: nodePort: 31312COMPUTED VALUES:DeploymentUpdate: maxSurge: 100% maxUnavailable: 0 type: RollingUpdateStatefulSetUpdate: updateStrategy: RollingUpdate. # View the parameters customized during the installation of this release. $helm get values gilded-mule service: nodePort: 31312 upgrade, fallback, view version record, helm upgrade, helm rollback Helm hisotryhelm upgrade-- set service.nodePort=31312 gilded-mule stable/minio helm rollback gilded-mule 1helm hisotry gilded-mule delete helm delete $releaseNamehelm list-- use allrepository to view the current warehouse Helm repo list creates its own warehouse mkdir-p ~ / my-reponohup helm serve-- address 127.0.0.1 address 8879-- repo-path ~ / my-repo & # at this time, it will create a new index.html file under mys-repo and add its own warehouse helm repo add my-repo http://127.0.0.1:8879.
Add packages and update index in your own warehouse
# go to github to download chartscp-r mysql ~ / my-repocd ~ / my-repohelm package mysql-- save=false helm repo index-- url= http://127.0.0.1:8879. Update the repository cache, helm update to create its own charts quick creation template, helm create my-charts, modify the corresponding content packaging, and then copy to the repository directory, and then perform update index operation. Helm package installation, helm install. Or helm install my-charts.tgz to verify the charts format, helm lint to view the charts file content. Helm inspect chart my-charts looks at the contents of the value file. Helm inspect values my-charts looks at the contents of the files in the charts directory. Helm inspect my-charts views yaml,helm template my-charts-f configfile-- set astatb of k8s after charts template rendering
Note: if the serviceaccount of tiller only has the permission of its own namespace, then the namespaces in charts should also be specified in the namespaces of tiller.