LinuCエヴァンジェリストの鯨井貴博@opensourcetechです。
はじめに
今回は、kubernetesへのパッケージ管理ツールであるhelmをインストールします。
なお、kubernetesは以下の記事で作成したクラスターを使っています。
DualStack(IPv4 & IPv6)のkubernetesクラスター構築(v1.26.00・ubuntu22.04)
https://www.opensourcetech.tokyo/entry/20230314/1678782139
レポジトリの設定
まず、レポジトリの設定をします。
kubeuser@master01:~$ curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null [sudo] password for kubeuser: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1700 100 1700 0 0 5078 0 --:--:-- --:--:-- --:--:-- 5089 kubeuser@master01:~$ sudo apt install apt-transport-https --yes Reading package lists... Done Building dependency tree... Done Reading state information... Done apt-transport-https is already the newest version (2.4.8). 0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded. kubeuser@master01:~$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list deb [arch=amd64 signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main kubeuser@master01:~$ sudo apt install apt-transport-https --yes Reading package lists... Done Building dependency tree... Done Reading state information... Done apt-transport-https is already the newest version (2.4.8). 0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded. kubeuser@master01:~$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee deb [arch=amd64 signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main kubeuser@master01:~$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list deb [arch=amd64 signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main kubeuser@master01:~$ sudo apt update Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease Hit:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease Get:3 https://baltocdn.com/helm/stable/debian all InRelease [7652 B] Hit:4 http://jp.archive.ubuntu.com/ubuntu jammy InRelease Get:5 https://baltocdn.com/helm/stable/debian all/main amd64 Packages [3332 B] Get:6 http://jp.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] Get:7 http://jp.archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB] Get:8 http://jp.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Get:9 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [990 kB] Get:10 http://jp.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [898 kB] Get:11 http://jp.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 c-n-f Metadata [18.5 kB] Get:12 http://jp.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [716 kB] Get:13 http://jp.archive.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [14.1 kB] Fetched 2984 kB in 4s (781 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 31 packages can be upgraded. Run 'apt list --upgradable' to see them. W: https://download.docker.com/linux/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. W: https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
helmのインストール
続いて、aptを使ってhelmをインストールします。
kubeuser@master01:~$ sudo apt install helm Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: helm 0 upgraded, 1 newly installed, 0 to remove and 31 not upgraded. Need to get 15.0 MB of archives. After this operation, 46.9 MB of additional disk space will be used. Get:1 https://baltocdn.com/helm/stable/debian all/main amd64 helm amd64 3.11.2-1 [15.0 MB] Fetched 15.0 MB in 2s (6112 kB/s) Selecting previously unselected package helm. (Reading database ... 109549 files and directories currently installed.) Preparing to unpack .../helm_3.11.2-1_amd64.deb ... Unpacking helm (3.11.2-1) ... Setting up helm (3.11.2-1) ... Processing triggers for man-db (2.10.2-1) ... Scanning processes... Scanning candidates... Scanning linux images... Restarting services... systemctl restart packagekit.service Service restarts being deferred: systemctl restart networkd-dispatcher.service systemctl restart unattended-upgrades.service No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host.
途中で以下が表示されますが、そのままOKとします。
helmの使い方
helmの使い方ですが、
①repositoryの追加(helm repo add)
②パッケージのインストール(helm install)
と進めます。
https://helm.sh/ja/docs/intro/install/
kubeuser@master01:~$ helm --help 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: | Name | Description | |------------------------------------|---------------------------------------------------------------------------------------------------| | $HELM_CACHE_HOME | set an alternative location for storing cached files. | | $HELM_CONFIG_HOME | set an alternative location for storing Helm configuration. | | $HELM_DATA_HOME | set an alternative location for storing Helm data. | | $HELM_DEBUG | indicate whether or not Helm is running in Debug mode | | $HELM_DRIVER | set the backend storage driver. Values are: configmap, secret, memory, sql. | | $HELM_DRIVER_SQL_CONNECTION_STRING | set the connection string the SQL storage driver should use. | | $HELM_MAX_HISTORY | set the maximum number of helm release history. | | $HELM_NAMESPACE | set the namespace used for the helm operations. | | $HELM_NO_PLUGINS | disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. | | $HELM_PLUGINS | set the path to the plugins directory | | $HELM_REGISTRY_CONFIG | set the path to the registry config file. | | $HELM_REPOSITORY_CACHE | set the path to the repository cache directory | | $HELM_REPOSITORY_CONFIG | set the path to the repositories file. | | $KUBECONFIG | set an alternative Kubernetes configuration file (default "~/.kube/config") | | $HELM_KUBEAPISERVER | set the Kubernetes API Server Endpoint for authentication | | $HELM_KUBECAFILE | set the Kubernetes certificate authority file. | | $HELM_KUBEASGROUPS | set the Groups to use for impersonation using a comma-separated list. | | $HELM_KUBEASUSER | set the Username to impersonate for the operation. | | $HELM_KUBECONTEXT | set the name of the kubeconfig context. | | $HELM_KUBETOKEN | set the Bearer KubeToken used for authentication. | | $HELM_KUBEINSECURE_SKIP_TLS_VERIFY | indicate if the Kubernetes API server's certificate validation should be skipped (insecure) | | $HELM_KUBETLS_SERVER_NAME | set the server name used to validate the Kubernetes API server certificate | | $HELM_BURST_LIMIT | set the default burst limit in the case the server contains many CRDs (default 100, -1 to disable)| 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 System | Cache Path | Configuration Path | Data 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 push push a chart to remote registry login to or logout from a registry 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: --burst-limit int client-side default throttling limit (default 100) --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-insecure-skip-tls-verify if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kube-tls-server-name string server name to use for Kubernetes API server certificate validation. If it is not provided, the hostname used to contact the server is used --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 "/home/kubeuser/.config/helm/registry/config.json") --repository-cache string path to the file containing cached repository indexes (default "/home/kubeuser/.cache/helm/repository") --repository-config string path to the file containing repository names and URLs (default "/home/kubeuser/.config/helm/repositories.yaml") Use "helm [command] --help" for more information about a command.