容器编排系统K8s之包管理器Helm基础使用

一、helm3的安装

下载二进制包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@master01 ~]# mkdir helm
[root@master01 ~]# cd helm/
[root@master01 helm]# wget https://get.helm.sh/helm-v3.5.0-linux-amd64.tar.gz
–2021-01-20 21:10:33-- https://get.helm.sh/helm-v3.5.0-linux-amd64.tar.gz
Resolving get.helm.sh (get.helm.sh)… 152.195.19.97, 2606:2800:11f:1cb7:261b:1f9c:2074:3c
Connecting to get.helm.sh (get.helm.sh)|152.195.19.97|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 12327633 (12M) [application/x-tar]
Saving to: ‘helm-v3.5.0-linux-amd64.tar.gz’

100%[==================================================================================================================================>] 12,327,633 9.17MB/s in 1.3s

2021-01-20 21:10:35 (9.17 MB/s) - ‘helm-v3.5.0-linux-amd64.tar.gz’ saved [12327633/12327633]
[root@master01 helm]#ls
helm-v3.5.0-linux-amd64.tar.gz
[root@master01 helm]
  解压包

1
2
3
4
5
6
7
[root@master01 helm]# tar xf helm-v3.5.0-linux-amd64.tar.gz
[root@master01 helm]# ls
helm-v3.5.0-linux-amd64.tar.gz linux-amd64
[root@master01 helm]# cd linux-amd64/
[root@master01 linux-amd64]# ls
helm LICENSE README.md
[root@master01 linux-amd64]#
  复制helm二进制文件到path环境变量目录下

1
2
3
4
[root@master01 linux-amd64]# cp helm /usr/bin/
[root@master01 linux-amd64]# hel
helm help
[root@master01 linux-amd64]# hel
  二、helm的使用

查看helm版本

1
2
3
[root@master01 ~]# helm version
version.BuildInfo{Version:“v3.5.0”, GitCommit:“32c22239423b3b4ba6706d450bd044baffdcf9e6”, GitTreeState:“clean”, GoVersion:“go1.15.6”}
[root@master01 ~]#
  查看helm帮助

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
[root@master01 ~]# helm -h
The Kubernetes package manager

Common actions for Helm:

  • helm search: search for charts
  • helm pull: download a chart to your local directory to view
  • helm install: upload the chart to Kubernetes
  • helm list: list releases of charts

Environment variables:

NameDescription
$HELM_CACHE_HOMEset an alternative location for storing cached files.
$HELM_CONFIG_HOMEset an alternative location for storing Helm configuration.
$HELM_DATA_HOMEset an alternative location for storing Helm data.
$HELM_DEBUGindicate whether or not Helm is running in Debug mode
$HELM_DRIVERset the backend storage driver. Values are: configmap, secret, memory, postgres
$HELM_DRIVER_SQL_CONNECTION_STRINGset the connection string the SQL storage driver should use.
$HELM_MAX_HISTORYset the maximum number of helm release history.
$HELM_NAMESPACEset the namespace used for the helm operations.
$HELM_NO_PLUGINSdisable plugins. Set HELM_NO_PLUGINS=1 to disable plugins.
$HELM_PLUGINSset the path to the plugins directory
$HELM_REGISTRY_CONFIGset the path to the registry config file.
$HELM_REPOSITORY_CACHEset the path to the repository cache directory
$HELM_REPOSITORY_CONFIGset the path to the repositories file.
$KUBECONFIGset an alternative Kubernetes configuration file (default “~/.kube/config”)
$HELM_KUBEAPISERVERset the Kubernetes API Server Endpoint for authentication
$HELM_KUBECAFILEset the Kubernetes certificate authority file.
$HELM_KUBEASGROUPSset the Groups to use for impersonation using a comma-separated list.
$HELM_KUBEASUSERset the Username to impersonate for the operation.
$HELM_KUBECONTEXTset the name of the kubeconfig context.
$HELM_KUBETOKENset the Bearer KubeToken used for authentication.

Helm stores cache, configuration, and data based on the following configuration order:

  • If a HELM_*_HOME environment variable is set, it will be used
  • Otherwise, on systems supporting the XDG base directory specification, the XDG variables will be used
  • When no other location is set a default location will be used based on the operating system

By default, the default directories depend on the Operating System. The defaults are listed below:

Operating SystemCache PathConfiguration PathData Path
Linux$HOME/.cache/helm$HOME/.config/helm$HOME/.local/share/helm
macOS$HOME/Library/Caches/helm$HOME/Library/Preferences/helm$HOME/Library/helm
Windows%TEMP%\helm%APPDATA%\helm%APPDATA%\helm

Usage:
helm [command]

Available Commands:
completion generate autocompletion scripts for the specified shell
create create a new chart with the given name
dependency manage a chart’s dependencies
env helm client environment information
get download extended information of a named release
help Help about any command
history fetch release history
install install a chart
lint examine a chart for possible issues
list list releases
package package a chart directory into a chart archive
plugin install, list, or uninstall Helm plugins
pull download a chart from a repository and (optionally) unpack it in local directory
repo add, list, remove, update, and index chart repositories
rollback roll back a release to a previous revision
search search for a keyword in charts
show show information of a chart
status display the status of the named release
template locally render templates
test run tests for a release
uninstall uninstall a release
upgrade upgrade a release
verify verify that a chart at the given path has been signed and is valid
version print the client version information

Flags:
–debug enable verbose output
-h, --help help for helm
–kube-apiserver string the address and the port for the Kubernetes API server
–kube-as-group stringArray group to impersonate for the operation, this flag can be repeated to specify multiple groups.
–kube-as-user string username to impersonate for the operation
–kube-ca-file string the certificate authority file for the Kubernetes API server connection
–kube-context string name of the kubeconfig context to use
–kube-token string bearer token used for authentication
–kubeconfig string path to the kubeconfig file
-n, --namespace string namespace scope for this request
–registry-config string path to the registry config file (default “/root/.config/helm/registry.json”)
–repository-cache string path to the file containing cached repository indexes (default “/root/.cache/helm/repository”)
–repository-config string path to the file containing repository names and URLs (default “/root/.config/helm/repositories.yaml”)

Use “helm [command] --help” for more information about a command.
[root@master01 ~]#
  查看仓库列表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[root@master01 ~]# helm repo -h

This command consists of multiple subcommands to interact with chart repositories.

It can be used to add, remove, list, and index chart repositories.

Usage:
helm repo [command]

Available Commands:
add add a chart repository
index generate an index file given a directory containing packaged charts
list list chart repositories
remove remove one or more chart repositories
update update information of available charts locally from chart repositories

Flags:
-h, --help help for repo

Global Flags:
–debug enable verbose output
–kube-apiserver string the address and the port for the Kubernetes API server
–kube-as-group stringArray group to impersonate for the operation, this flag can be repeated to specify multiple groups.
–kube-as-user string username to impersonate for the operation
–kube-ca-file string the certificate authority file for the Kubernetes API server connection
–kube-context string name of the kubeconfig context to use
–kube-token string bearer token used for authentication
–kubeconfig string path to the kubeconfig file
-n, --namespace string namespace scope for this request
–registry-config string path to the registry config file (default “/root/.config/helm/registry.json”)
–repository-cache string path to the file containing cached repository indexes (default “/root/.cache/helm/repository”)
–repository-config string path to the file containing repository names and URLs (default “/root/.config/helm/repositories.yaml”)

Use “helm repo [command] --help” for more information about a command.
[root@master01 ~]# helm repo list
Error: no repositories to show
[root@master01 ~]#
  提示:这里提示我们没有仓库;

添加仓库

1
2
3
4
5
6
[root@master01 ~]# helm repo add stable https://charts.helm.sh/stable
“stable” has been added to your repositories
[root@master01 ~]# helm repo list
NAME URL
stable https://charts.helm.sh/stable
[root@master01 ~]#
深圳网站建设www.sz886.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值