# Helm命令

本文将介绍helm的常用命令

## helm init

to be continued

## helm install

```
helm install stable/tomcat --version=0.2.0
helm install ./tomcat-0.2.0.tgz
helm install ./tomcat-0.2.0
helm install https://kubernetes-charts.storage.googleapis.com/tomcat-0.2.0.tgz
helm install --repo https://kubernetes-charts.storage.googleapis.com nginx --version=x.x.x
```

## helm repo

```
helm repo list
helm repo add name URL
helm repo remove name
helm repo update    # like yum makecache
helm repo index DIR    # generate index.yaml
```

### helm repo list

```
$ helm repo list
NAME URL
stable    https://kubernetes-charts.storage.googleapis.com
local http://127.0.0.1:8879/charts
```

可以看到`stable`这个repository对应的URL是`https://kubernetes-charts.storage.googleapis.com`，它其实就是google的repository。其实我们也可以在`~/.helm/repository/repositories.yaml`文件中找到相同的内容（其中`~`表示执行`helm init`时所使用的用户的主目录）

```
apiVersion: v1
generated: 2019-04-08T05:21:15.557206406-04:00
repositories:
- caFile: ""
cache: /root/.helm/repository/cache/stable-index.yaml
certFile: ""
keyFile: ""
name: stable
password: ""
url: https://kubernetes-charts.storage.googleapis.com
username: ""
- caFile: ""
cache: /root/.helm/repository/cache/local-index.yaml
certFile: ""
keyFile: ""
name: local
password: ""
url: http://127.0.0.1:8879/charts
username: ""
```

### helm repo index
