最新helm3
helm是乙個kubernetes的包管理工具,就像linux下的包管理器,如yum/apt等,可以很方便的將之前打包好的yaml檔案部署到kubernetes上。
helm有兩個重要概念:
helm:乙個命令列客戶端工具,主要用於kubernetes應用chart的建立、打包、發布和管理。
chart:應用描述,一系列用於描述 k8s 資源相關檔案的集合。
release:基於chart的部署實體,乙個 chart 被 helm 執行後將會生成對應的乙個 release;將在k8s中建立出真實執行的資源物件。
wget
tar zxvf helm-v3.0.0-linux-amd64.tar.gz
mv linux-amd64/helm /usr/bin/
檢視配置的儲存庫:helm repo add stable
helm repo add aliyun
helm repo update
刪除儲存庫:helm repo list
helm search repo stable
helm repo remove aliyun
主要介紹三個命令:
查詢chart:
為什麼mariadb也在列表中?因為他和mysql有關。helm search repo
helm search repo mysql
檢視chart資訊:
helm show chart stable/mysql
安裝包:
helm install db stable/mysql
檢視發布狀態:
helm status db
上面部署的mysql並沒有成功,這是因為並不是所有的chart都能按照預設配置執行成功,可能會需要一些環境依賴,例如pv。
所以我們需要自定義chart配置選項,安裝過程中有兩種方法可以傳遞配置資料:
找到我們的nfs-storagehelm show values stable/mysql
## persist data to a persistent volume
persistence:
enabled: true
## database data persistent volume storage class
## if defined, storageclassname:
## if set to "-", storageclassname: "", which disables dynamic provisioning
## if undefined (the default) or set to null, no storageclassname spec is
## set, choosing the default provisioner. (gp2 on aws, standard on
## gke, aws & openstack)
### storageclass: "-"
accessmode: readwriteonce
size: 8gi
annotations:
managed-nfs-storage fuseim.pri/ifs 13m先解除安裝:
helm uninstall db
命令列替代變數安裝mysql:
安裝完畢後mysql就正常執行了。helm install db --set persistence.storageclass=
"managed-nfs-storage" stable/mysql
我們還可以使用yaml檔案來定義變數安裝:
我們先導出模板然後修改:
以上將建立具有名稱的預設mysql使用者liaochao,並授予此使用者訪問新建立的k8s資料庫的許可權,但將接受該圖表的所有其餘預設值。helm show values stable/mysql > config.yaml
[root@master demo]
# cat config.yaml
mysqlrootpassword: testing
mysqluser: liaochao
mysqlpassword: k8s
mysqldatabase: k8s
persistence:
enabled: true
storageclass: "managed-nfs-storage"
accessmode: readwriteonce
size: 8gi
指定yaml檔案安裝mysql:
helm install db2 -f config.yaml stable/mysql
helm pull stable/mysql --untar
k8s 1 HELM使用詳解
1.安裝 wget mv linux amd64 helm usr local bin helm helm search hub helm repo list helm倉庫檢視 helm repo add stable 倉庫新增 helm repo add google helm repo add ...
tensorflow基礎使用1
1.op的設計及執行乙個簡單的圖import tensorflow as tf x tf.variable 1,2 建立變數 a tf.constant 3,3 建立常量 sub tf.subtract x,a 定義減法op add tf.add x,sub 定義加法op init tf.globa...
mysql 使用基礎 1
使用命令列連線 mysql mysql uroot p passowrd hlocalhost p port code mysql show databases 顯示資料庫 mysql use test 使用 test 資料庫 mysql show tables 顯示表資訊 mysql descri...