operação avançada do leme
Diretório de artigos
- operação avançada do leme
-
- 1. Gerenciamento de armazém
-
- 1.1 Visualize a lista de repositórios```lista de repositórios do Helm```:
- 1.2 Excluir um warehouse```helm repo remove warehouse name```Remover um warehouse:
- 1.3 Adicionar cache do warehouse```repositório helm add```
- 1.4 Atualizar um endereço de armazém```helm repo remove xxx && helm repo add ```
- 1.5 Atualizar o cache do warehouse```atualização do repo do helm```
- 1.6 pacote de gráficos de pesquisa do leme ```pesquisa do leme ```
- 2. Lista de armazéns disponíveis
- 3. Uso de armazém local
-
- 3.1 Após a instalação do leme, um depósito local será adicionado por padrão
- 3.2 Inicie o serviço de depósito local```servidor de comando ```
- 3.2 Adicionar o pacote de gráficos ao armazém local
- 3.3 Testar o armazém local
- 3.2.4 Converta os arquivos no github para o pacote de gráficos e carregue o armazém de gráficos local
- 3.2.5 Atualize o arquivo index.yaml```helm repo index```
- 3.3 projeto de código aberto do github, tornando o helm mirror warehouse
- 4. Várias maneiras de instalar o release no leme
- 5. Operações comuns do leme
1. Gerenciamento de armazém
Adição, exclusão, modificação e consulta do armazém de gráficos
1.1 Visualize a lista de armazéns helm repo list
:
[root@hw-apptest01-11-172 ~]# helm repo list
NAME URL
local http://127.0.0.1:8879/charts
incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/
kiwigrid https://kiwigrid.github.io
stable-ali https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
elastic https://helm.elastic.co
stable https://burdenbear.github.io/kube-charts-mirror/
Use helm repo list
para visualizar a conexão de URL para o armazém, o nome do conjunto, etc.
1.2 Excluir um depósito helm repo remove 仓库名称
Para remover um depósito:
[root@hw-apptest01-11-172 efk]# helm repo list
NAME URL
stable https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
local http://127.0.0.1:8879/charts
incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/
kiwigrid https://kiwigrid.github.io
[root@hw-apptest01-11-172 efk]# helm repo remove stable
"stable" has been removed from your repositories
1.3 Adicionar cache de depósitohelm repo add
helm repo add stable https://burdenbear.github.io/kube-charts-mirror/
"incubator" has been added to your repositories
# helm 仓库并发单纯的tgz charts包,还需要用index.yaml 文件
[root@hw-apptest01-11-172 efk]# helm repo add gstabe https://github.com/helm/charts/
Error: Looks like "https://github.com/helm/charts/" is not a valid chart repository or cannot be reached: Failed to fetch https://github.com/helm/charts/index.yaml : 404 Not Found
1.4 Atualizar um endereço de depósitohelm repo remove xxx && helm repo add
# 1.2 中我们删除了stable的阿里云仓库,现在我们修改为stable-ali
[root@hw-apptest01-11-172 efk]# helm repo add stable-ali https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
"stable-ali" has been added to your repositories
[root@hw-apptest01-11-172 ~]# helm repo list
NAME URL
local http://127.0.0.1:8879/charts
incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/
kiwigrid https://kiwigrid.github.io
stable-ali https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
elastic https://helm.elastic.co
stable https://burdenbear.github.io/kube-charts-mirror/
1.5 Atualizar o cache do warehousehelm repo update
O warehouse de gráficos do Helm é atualizado com frequência e, às vezes, precisamos atualizar o cache do warehouse
[root@hw-apptest01-11-172 efk]# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
...Successfully got an update from the "incubator" chart repository
...Successfully got an update from the "kiwigrid" chart repository
Update Complete. ⎈ Happy Helming!⎈
1.6 pacote de gráficos de pesquisa do lemehelm search
[root@hw-apptest01-11-172 ~]# helm search stable/elasticsearch
NAME CHART VERSION APP VERSION DESCRIPTION
stable/elasticsearch 1.29.0 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch-curator 1.5.0 5.5.4 A Helm chart for Elasticsearch Curator
stable/elasticsearch-exporter 1.4.1 1.0.2 Elasticsearch stats exporter for Prometheus
# helm search xxx -l 查看各个版本
[root@hw-apptest01-11-172 ~]# helm search stable/elasticsearch -l
NAME CHART VERSION APP VERSION DESCRIPTION
stable/elasticsearch 1.29.0 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.28.5 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.28.4 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.28.2 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.28.1 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.28.0 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.27.3 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.27.2 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.26.2 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.26.1 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.26.0 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.25.0 6.7.0 Flexible and powerful open source, distributed real-time ...
stable/elasticsearch 1.24.0 6.7.0 Flexible and powerful open source, distributed real-time ...
2. Lista de armazéns disponíveis
nome do armazém | url | Observação |
---|---|---|
A imagem estável é acessível domesticamente | https://burdenbear.github.io/kube-charts-mirror/ | Espelho do repositório oficial |
imagem estável de Aliyun | https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/ | A imagem estável do Alibaba Cloud parou de atualizar |
incubadora | https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/ | Incubadora Alibaba Cloud Mirror |
imagem oficial estável | https://hub.kubeapps.com/ | Não disponível na China |
imagem de nuvem estável da Microsoft | http://mirror.azure.cn/kubernetes/charts/ | imagem de nuvem da Microsoft |
incubadora Microsoft cloud image | http://mirror.azure.cn/kubernetes/charts-incubator/ | imagem de nuvem da Microsoft |
Faça sua própria referência de armazém de espelho hlem: https://github.com/taowujie/kube-charts-mirror
3. Uso de armazém local
3.1 Após a instalação do leme, um depósito local será adicionado por padrão
O depósito local não possui monitoramento externo por padrão e o endereço do depósito local não está em execução
[root@hw-apptest01-11-172 local]# helm repo list
NAME URL
local http://127.0.0.1:8879/charts
incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/
kiwigrid https://kiwigrid.github.io
stable-ali https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
elastic https://helm.elastic.co
stable https://burdenbear.github.io/kube-charts-mirror/
[root@hw-apptest01-11-172 local]# netstat -tnlp |grep 8879
[root@hw-apptest01-11-172 local]#
3.2 Inicie o serviço de depósito localhelm serve
3.2.1 Executar o serviço do leme para iniciar o depósito do leme
[root@hw-apptest01-11-172 local]# helm serve
Regenerating index. This may take a moment.
Now serving you on 127.0.0.1:8879
# 默认情况下监听127.0.0.1的8879端口,路径~/.helm/repository/local/
## ctrl +c 进程将停止
### 新开窗口查看进程端口
[root@hw-apptest01-11-172 ~]# netstat -tnlp |grep 8879
tcp 0 0 127.0.0.1:8879 0.0.0.0:* LISTEN 855/helm
[root@hw-apptest01-11-172 ~]# ps -ef |grep helm
root 855 119876 0 14:15 pts/0 00:00:00 helm serve
root 1376 965 0 14:15 pts/1 00:00:00 grep --color=auto helm
# 查看仓库包
[root@hw-apptest01-11-172 ~]# curl http://127.0.0.1:8879
<html>
<head>
<title>Helm Repository</title>
</head>
<h1>Helm Charts Repository</h1>
<ul>
</ul>
<body>
<p>Last Generated: 2019-07-04 14:15:04.794745966 +0800 CST</p>
</body>
</html>
## 默认情况下没有可以用的包
3.1.2 Parâmetros do comando de inicialização do helm warehouse:
helm serve --address 0.0.0.0:8879 --repo-path /data/helm/data
--address 指定IP地址 端口
--repo-path /xxx 指定启动charts仓库地址
# 可以使用 nohup参数进行最小化
nohup helm serve --address 0.0.0.0:8879 --repo-path /data/helm/data &> /data/helm/helm-server.log &
3.2 Adicionar o pacote de gráficos ao armazém local
Os pacotes no armazém de gráficos estão todos no formato tgz. Simulamos o armazém local onde fazemos pacotes de gráficos e os carregamos nós mesmos.
[root@hw-apptest01-11-172 stable]# tar -czf kibana.tgz kibana
[root@hw-apptest01-11-172 stable]# mv kibana.tgz ~/.helm/repository/local/
[root@hw-apptest01-11-172 ~]# nohup helm serve &
3.3 Testar o armazém local
[root@hw-apptest01-11-172 ~]# helm search local/kibana
NAME CHART VERSION APP VERSION DESCRIPTION
local/kibana 3.2.0 6.7.0 Kibana is an open source data visualization plugin for El...
# web界面测试
[root@hw-apptest01-11-172 ~]# curl 127.0.0.1:8879
<html>
<head>
<title>Helm Repository</title>
</head>
<h1>Helm Charts Repository</h1>
<ul>
<li>kibana<ul>
<li><a href="http://127.0.0.1:8879/kibana.tgz">kibana-3.2.0</a></li>
</ul>
</li>
</ul>
<body>
<p>Last Generated: 2019-06-23 18:18:26.147302181 +0800 CST</p>
</body>
</html>
3.2.4 Converta os arquivos no github para o pacote de gráficos e carregue o armazém de gráficos local
A maneira de obter o pacote de gráficos local é criar manualmente o pacote de gráficos, copiar o pacote de gráficos em outras máquinas e obter o pacote de gráficos no github.
O endereço padrão do armazém estável é inacessível na China, mas o projeto oficial k8s github tem um arquivo de armazém estável no projeto de gráficos.
Endereço: https://github.com/helm/charts.git, que contém o arquivo oficial da lista de gráficos, que
é helm package elasticsearch
automaticamente empacotado e carregado no armazém local
# git clone https://github.com/helm/charts.git
[root@hw-apptest01-11-172 Git]# cd charts/
[root@hw-apptest01-11-172 charts]# ls
code-of-conduct.md CONTRIBUTING.md incubator LICENSE OWNERS PROCESSES.md README.md REVIEW_GUIDELINES.md stable test
[root@hw-apptest01-11-172 charts]# cd stable/
[root@hw-apptest01-11-172 stable]# helm package elasticsearch
Successfully packaged chart and saved it to: /data/Git/charts/stable/elasticsearch-1.29.0.tgz
[root@hw-apptest01-11-172 stable]# helm repo update
Update Complete. ⎈ Happy Helming!⎈
[root@hw-apptest01-11-172 stable]# curl 127.0.0.1:8879
<html>
<head>
<title>Helm Repository</title>
</head>
<h1>Helm Charts Repository</h1>
<ul>
<li>elasticsearch<ul>
<li><a href="http://127.0.0.1:8879/charts/elasticsearch-1.29.0.tgz">elasticsearch-1.29.0</a></li>
</ul>
</li>
<li>kibana<ul>
<li><a href="http://127.0.0.1:8879/kibana.tgz">kibana-3.2.0</a></li>
</ul>
</li>
</ul>
<body>
<p>Last Generated: 2019-07-04 16:22:48.141108297 +0800 CST</p>
</body>
</html>
[root@hw-apptest01-11-172 stable]# helm search local/elasticsearch -l
NAME CHART VERSION APP VERSION DESCRIPTION
local/elasticsearch 1.29.0 6.7.0 Flexible and powerful open source, distributed real-time ...
Referência: https://blog.csdn.net/u011659193/article/details/87893911
3.2.5 Atualize o arquivo index.yamlhelm repo index
O helm warehouse carregará o index.yaml para recuperar a versão indisponível do pacote de gráficos. Quando produzimos manualmente o pacote de tags, precisamos atualizar o index.yaml após carregá-lo no diretório local
[root@hw-apptest01-11-172 stable]# cd ~/.helm/repository/local/
[root@hw-apptest01-11-172 local]# ls
elasticsearch-1.29.0.tgz index.yaml kibana.tgz
[root@hw-apptest01-11-172 local]# helm repo index .
[root@hw-apptest01-11-172 local]# ls
elasticsearch-1.29.0.tgz index.yaml kibana.tgz
3.3 projeto de código aberto do github, tornando o helm mirror warehouse
Endereço: https://github.com/taowujie/kube-charts-mirror
4. Várias maneiras de instalar o release no leme
4.1 Espelhamento normal
helm fetch 应用名
helm install --name=xx --namespace=xx -f xx/value.yml 仓库/应用名
4.2 Adicionar número da versão
helm install --name=xx --namespace=xx -f xx/value.yml xxx --version=xxxx
[root@hw-apptest01-11-172 elasticsearch]# helm install --name=elstest --namespace=efk -f values.yaml stable/elasticsearch --version=1.28.5
NAME: elstest
LAST DEPLOYED: Wed Jun 26 21:53:35 2019
NAMESPACE: efk
STATUS: DEPLOYED
......
4.3 Especificar o arquivo do pacote de gráficos
helm install --name=xx --namespace=xx -f xx/value.yml xxx.tgz
[root@hw-apptest01-11-172 elasticsearch]# helm install --name=elstest --namespace=efk -f values.yaml ../elasticsearch-1.28.5.tgz
NAME: elstest
LAST DEPLOYED: Wed Jun 26 21:53:35 2019
NAMESPACE: efk
STATUS: DEPLOYED
......
4.4 Especifique o diretório do pacote gráfico (diretório de descompactação)
helm install --name=xx --namespace=xx -f xx/value.yml xxx
[root@hw-apptest01-11-172 elasticsearch]# helm install --name=elstest --namespace=efk -f values.yaml .
NAME: elstest
LAST DEPLOYED: Wed Jun 26 21:53:35 2019
NAMESPACE: efk
STATUS: DEPLOYED
......
5. Operações comuns do leme
查找 helm search CHARTNAME
检查 helm inspect CHARTNAME
安装 helm install --name mem1 stable/memcached
获取状态信息 helm status mem1
列出 helm list [-a]
删除 helm delete [--purge] mem1
下载 helm fetch stable/redis
创建 helm create CHARTNAME
语法检测 helm lint CHARTNAME
打包 helm package CHARTNAME
显示release状态 helm status NAME
启动本地仓库 helm serve