1.Helm的简介

Helm是Kubernetes的一个包管理工具,用来简化Kubernetes应用的部署和管理。可以把Helm比作CentOS的yum工具。 Helm有如下几个基本概念:
Chart: 是Helm管理的安装包,里面包含需要部署的安装包资源。可以把Chart比作CentOS yum使用的rpm文件。每个Chart包含下面两部分:
  1.包的基本描述文件Chart.yaml
  2.放在templates目录中的一个或多个Kubernetes manifest文件模板
Release:是chart的部署实例,一个chart在一个Kubernetes集群上可以有多个release,即这个chart可以被安装多次
Repository:chart的仓库,用于发布和存储chart
使用Helm可以完成以下事情:
  1.管理Kubernetes manifest files
  2.管理Helm安装包charts
  3.基于chart的Kubernetes应用分发

二、Helm的组成

Helm由两部分组成,客户端helm和服务端tiller。
  1.tiller运行在Kubernetes集群上,管理chart安装的release
  2.helm是一个命令行工具,可在本地运行,一般运行在CI/CD Server上。

三、安装helm和tiller

1.下载helm
[root@master- ~]# wget https://storage.googleapis.com/kubernetes-helm/helm-v2.12.1-linux-amd64.tar.gz  #如何无法科*学*上*网可以从我的网盘中下载 链接: (https://pan.baidu.com/s/1XmVnCMmNVOf1puRqgoqdXw 提取码: 44s1)
[root@master- ~]# tar xf helm-v2.12.1-linux-amd64.tar.gz
总用量
-rw-------. root root -- : anaconda-ks.cfg
-rw-r--r-- root root -- : helm-v2.12.1-linux-amd64.tar.gz
drwxr-xr-x root root -- : linux-amd64
[root@master- linux-amd64]# ll
总用量
-rwxr-xr-x root root -- : helm
-rw-r--r-- root root -- : LICENSE
-rw-r--r-- root root -- : README.md
-rwxr-xr-x root root -- : tiller
[root@master- linux-amd64]# cp helm /usr/bin/ #下载解压完成后,直接将helm执行文件放入PATH环境变量中就可以使用了
[root@master- linux-amd64]# helm -h
2.安装 tiller

由于tiller需要安装、删除等操作pod的权限,所以要为tiller设置相应的权限,权限可以分为集群级别或名称空间级别

配置文档:https://github.com/helm/helm/blob/master/docs/rbac.md

[root@master- ~]# mkdir manifests
[root@master- ~]# cd manifests/
[root@master- manifests]# ll
总用量
[root@master- manifests]# mkdir helm
[root@master- manifests]# cat tiller-rbac.yaml #创建tiller的rbac配置文件
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
[root@master- manifests]# kubectl apply -f tiller-rbac.yaml
serviceaccount/tiller created
clusterrolebinding.rbac.authorization.k8s.io/tiller created
[root@master- manifests]# kubectl get sa -n kube-system |grep tiller #确认是否创建成功
tiller 57s
[root@master- manifests]# helm init --service-account tiller --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.12.1 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts #由于墙的原因,所以我们使用阿里的chart仓库,注意指定的tiller版本需要和helm版本一致
$HELM_HOME has been configured at /root/.helm.
Tiller (the Helm server-side component) has been upgraded to the current version.
Happy Helming!
[root@master- manifests]# kubectl get pod -n kube-system |grep tiller #查看tiller的pod是否创建成功
tiller-deploy-7d898b45c4-knp4b / Running 2m
[root@master- manifests]# helm version
Client: &version.Version{SemVer:"v2.12.1", GitCommit:"02a47c7249b1fc6d8fd3b94e6b4babf9d818144e", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.12.1", GitCommit:"02a47c7249b1fc6d8fd3b94e6b4babf9d818144e", GitTreeState:"clean"}

可能遇到的报错:

E0224 ::16.077226     portforward.go:] an error occurred forwarding  -> : error forwarding port  to pod 76a7312e49220a229e443546a4b32d3e0406f09fd9b3646b3d30f6833e121375, uid : unable to do port forwarding: socat not found.
Error: cannot connect to Tiller

解决方法:

在所有节点和vip服务器上安装socat
yum -y install socat

如果只安装helm客户端,执行以下操作:

wget https://storage.googleapis.com/kubernetes-helm/helm-v2.12.1-linux-amd64.tar.gz  #下载安装包
helm init --client-only --stable-repo-url https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/ #使用--client-only 参数

四、常用命令

查看下载的包的信息

[root@master- manifests]# ll ~/.helm/cache/archive/   #helm下载的包路径
总用量
-rw-r--r-- root root -- : redis-1.1..tgz
[root@master- archive]# tar xf redis-1.1..tgz
tar: redis/Chart.yaml:不可信的旧时间戳 -- ::00 #时间戳告警可以忽略
.....
[root@master- archive]# tree redis
redis
├── Chart.yaml #描述当前chart有哪些属性信息
├── README.md #自述文件
├── templates #模板文件目录
│   ├── deployment.yaml #模板文件,之所以叫做模板文件是因为文件中大量使用了go语言模板
│   ├── _helpers.tpl
│   ├── networkpolicy.yaml
│   ├── NOTES.txt
│   ├── pvc.yaml
│   ├── secrets.yaml
│   └── svc.yaml
└── values.yaml #定义默认值 directory, files

其他:

[root@master- ~]# helm -h
[root@k8s-master templates]# helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator #添加一个repo仓库,名称为incubator
[root@k8s-master templates]# helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
[root@k8s-master templates]# helm repo remove stable #删除一个仓库,名称为stable
[root@k8s-master templates]# helm repo list #显示所有的仓库列表
[root@k8s-master templates]# helm repo update
[root@k8s-master templates]# helm search elasticsearch #搜索一个chart
[root@k8s-master templates]# helm fetch incubator/elasticsearch #下载一个chart并解压到本地
[root@k8s-master archive]# cd /root/.helm/cache/archive
[root@k8s-master archive]# ll

查看详细命令帮助: https://docs.helm.sh/helm/#helm

项目地址:https://github.com/helm/helm

下载地址:https://github.com/helm/helm/releases/

官方文档地址:https://docs.helm.sh/

helm官方网址:https://helm.sh/

helm chart官方网址:https://hub.kubeapps.com/  

kubernetes学习笔记之十四:helm入门的更多相关文章

  1. VSTO学习笔记(十四)Excel数据透视表与PowerPivot

    原文:VSTO学习笔记(十四)Excel数据透视表与PowerPivot 近期公司内部在做一种通用查询报表,方便人力资源分析.统计数据.由于之前公司系统中有一个类似的查询使用Excel数据透视表完成的 ...

  2. Python学习笔记(十四)

    Python学习笔记(十四): Json and Pickle模块 shelve模块 1. Json and Pickle模块 之前我们学习过用eval内置方法可以将一个字符串转成python对象,不 ...

  3. python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法

    python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法window安装redis,下载Redis的压缩包https://git ...

  4. 如鹏网学习笔记(十四)ASP.NET

    Asp.net笔记 一.Socket类 进行网络编程的类,可以在两台计算机之间进行网络通讯 过程: 向服务器发送指令: GET /index.html HTTP/1.1 Host:127.0.0.1: ...

  5. 《机器学习实战》学习笔记第十四章 —— 利用SVD简化数据

    相关博客: 吴恩达机器学习笔记(八) —— 降维与主成分分析法(PCA) <机器学习实战>学习笔记第十三章 —— 利用PCA来简化数据 奇异值分解(SVD)原理与在降维中的应用 机器学习( ...

  6. Android学习笔记(十四)——自定义广播

    //此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! 我们除了可以通过广播接收器来接收系统广播, 还可以在应用程序中发送自定义的广播.下面我们来分别试一试发送自定义 ...

  7. Dynamic CRM 2013学习笔记(十四)复制/克隆记录

    经常有这样的需求,一个单据上有太多要填写的内容,有时还关联多个子单据,客户不想一个一个地填写,他们想从已有的单据上复制数据,克隆成一条新的记录.本文将介绍如何克隆一条记录,包括它的子单据以生成一条新的 ...

  8. JavaScript学习笔记(十四)——对象

    在学习廖雪峰前辈的JavaScript教程中,遇到了一些需要注意的点,因此作为学习笔记列出来,提醒自己注意! 如果大家有需要,欢迎访问前辈的博客https://www.liaoxuefeng.com/ ...

  9. Java框架spring 学习笔记(十四):注解aop操作

    回见Java框架spring Boot学习笔记(十三):aop实例操作,这里介绍注解aop操作 首先编写一个切入点HelloWorld.java package com.example.spring; ...

随机推荐

  1. 游戏 & Github Page

    1. snakewizard.github.io 贪吃蛇小游戏 2. mattbasile.github.io 龙珠 DragonballZ-Battle 3. nathandhyou.github. ...

  2. 在c#中 RemoveAt、 Remove、delete用法区别

    有三种方法可以删除 DataTable 中的 DataRow: Delete 方法和 Remove 方法和 RemoveAt 方法 其区别是: Delete 方法实际上不是从 DataTable 中删 ...

  3. 支持pc和移动端的手写签批功能

    由于之前的业务需要,要求在pc端(用鼠标写字).移动端(手写)实现会签功能,然后百度下载了个签字插件,经过一些修改和功能添加,实现了现有的功能插件,效果如图: 代码下载地址:https://githu ...

  4. 剑指offer前6题

    二维数组中的查找 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数. 时间限制:1秒 ...

  5. 1.继承(extends)、超类(superClass)、子类(subClass)

    注意:继承主要使用的is-a关系 在子类中用一个新的方法来覆盖超类中的方法(override),需要注意的是如果子类之中的方法或者域  被覆盖时,仍然想访问superClass中的方法和域,此时必须使 ...

  6. 一次奇妙的http请求之旅

    TCP/IP不是一个协议,而是一个协议族的统称.里面包括IP协议.IMCP协议.TCP协议. 这里有几个需要注意的知识点: 互联网地址:也就是IP地址,一般为网络号+子网号+主机号 域名系统:通俗的来 ...

  7. TCP 三次握爪 四次挥手

    TCP三次握手和四次挥手过程 1.三次握手 (1)三次握手的详述 首先Client端发送连接请求报文,Server段接受连接后回复ACK报文,并为这次连接分配资源.Client端接收到ACK报文后也向 ...

  8. Android L2TP Client Setup

    原文链接:http://www.softether.org/4-docs/2-howto/9.L2TPIPsec_Setup_Guide_for_SoftEther_VPN_Server/3.Andr ...

  9. linux配置Anaconda python集成环境

    1.下载anaconda与安装 利用anaconda来配置python环境 如果你上面两步已经没有问题了,那么这一步可以省略. 如果你想简单一些,利用anaconda来配置python环境,那么直接从 ...

  10. zabbix升级遇到连接不上数据库的问题

    问题 迁移zabbix-server端时,原来是4.0版本,现在为4.2版本,遇到如下问题       解决办法 update dbversion set mandatory=;