这篇文章主要介绍了Helm管理工具怎么用,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
一 Helm 简介
Helm:
chart: 一个helm程序包
Repository: Charts仓库,https/http服务器
Release:特定的chart部署于目标集群上的一个实例
Chart -> Config -> Release
helm:客户端。管理本地Chart仓库,管理Chart,与Tiller服务器交互,发送Chart,实例安装,查询,卸载等操作
Tiller: 服务端,接收helm发来的Chart与Config,合并生成Release
二 部署Helm
1 下载helm
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-linux-amd64.tar.gz
2 解压
tar xf helm-v2.13.1-linux-amd64.tar.gz
3 安装helm
cd linux-amd64/
mv helm /usr/bin/
# helm version
Client: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
Error: could not find tiller
4 安装 tiller
部署tiller对于开启rbac认真的集群需要进行rbac授权并且绑定在集群级别的clusterrolebinding
# cat tiller-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
kubectl apply -f tiller-rbac.yaml
如果想要部署在特定的名称该空间使用请参考官网
https://github.com/helm/helm/blob/master/docs/rbac.md
查看tiller
# kubectl get serviceaccount -n kube-system | grep tiller
tiller 1 4m25s
5 初始化tiller
helm init --service-account tiller --history-max 200
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
可以预先设置下载proxy
export HTTPS_PROXY='http://www.ik8s.io:10080'
如果提示失败并且是连接https://ip:6443超时可以通过设置环境变量
export NO_PROXY='节点ip/16,回环地址/16'
再次安装
6 查看tiller
# kubectl get pod -n kube-system | grep tiller
tiller-deploy-876ff889-jjfn9 1/1 Running 0 4m29s
# helm version
Client: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
7 helm chart 官方可用仓库
1) helm.sh
2) hub.kubeapps.com
8 升级仓库
helm repo update
9 helm基本使用
1) 查看 某chart
# helm search jenkins
NAME CHART VERSION APP VERSION DESCRIPTION
stable/jenkins 1.1.16 lts Open source continuous integration server. It supports mu...
2) 查看chart的详细信息
helm inspect stable/jenkins
3) 安装某应用
helm install --name memcached stable/memcached
4) 卸载某个应用
helm delete memcached
5) 查看应用列表
helm list
6) 获取chart
helm get/fatch stable/jenkins
7) 历史管理
helm history memcached
8)创建chart
helm create ..
9) 打包
helm package ..
10) 回滚
helm rollback ...
11) 查看helm版本
helm version
12) 查看状态
helm status
......通过helm --help 获取
10 helm家目录
家目录主要查看我们使用过的chart
/root/.helm/
感谢你能够认真阅读完这篇文章,希望小编分享的“Helm管理工具怎么用”这篇文章对大家有帮助,同时也希望大家多多支持天达云,关注天达云行业资讯频道,更多相关知识等着你来学习!