29
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Helm v3についてつまづいた部分まとめ

Last updated at Posted at 2019-11-17

Helm がつい最近(2019/11/13)メジャーバージョンアップしてた

Helm v3 released: https://helm.sh/blog/helm-3-released/

調べた背景

必要に迫られHelmを使おうとしたところ、各サイトに書いてあるHelmコマンドがうまく動かない
以前Helmを使ったことがあったので、「最初はtiller入れるためにhelm initやな」というところからつまづいた。

helm init
~~helmのヘルプが長々と表示される~~

Usage:
  helm [command]

Available Commands:
  completion  Generate autocompletions script for the specified shell (bash or zsh)
  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        examines 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      displays 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

「helm initがない...だと...」

Helm v2からの主要な変更点(網羅できてません)

tillerがchartとconfigurationをreleaseとして管理してくれるんやろ、と思ってました
ただ、下記のリリースノートを見ると、「tillerの主目的はtillerなしで実現できた」とあり、tillerがいらない子になったようです。
Removal of Tiller: https://helm.sh/docs/faq/#removal-of-tiller

Release名がnamespaceごとに紐づくようになった

今まではnemaspaceが違くても、同じrelease名を使えないという制約がありつらみだった
しかし、releaseがnamespaceスコープに限定されるようになったため、namespaceごとに同名のreleaseを持てるようになった
もちろん、他のnamespaceにあるreleaseを下記のように参照することもできる

helm list --namespace foo

Helmのインストールと設定

helmのgithubリポジトリを見て、リポジトリの追加を行った

helmのインストール

brew install kubernetes-helm

chart取得用リポジトリの設定

helm repo add stable https://kubernetes-charts.storage.googleapis.com/ 

適当なnamespace作成

kubectl create namespace helm-test

適当なchart(ここではprometheus)の取得

$helm install stable/prometheus --generate-name
NAME: prometheus-1573980318
LAST DEPLOYED: Sun Nov 17 17:45:23 2019
NAMESPACE: helm-test
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:
prometheus-1573980318-server.helm-test.svc.cluster.local


Get the Prometheus server URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace helm-test -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace helm-test port-forward $POD_NAME 9090


The Prometheus alertmanager can be accessed via port 80 on the following DNS name from within your cluster:
prometheus-1573980318-alertmanager.helm-test.svc.cluster.local


Get the Alertmanager URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace helm-test -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace helm-test port-forward $POD_NAME 9093
#################################################################################
######   WARNING: Pod Security Policy has been moved to a global property.  #####
######            use .Values.podSecurityPolicy.enabled with pod-based      #####
######            annotations                                               #####
######            (e.g. .Values.nodeExporter.podSecurityPolicy.annotations) #####
#################################################################################


The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster:
prometheus-1573980318-pushgateway.helm-test.svc.cluster.local


Get the PushGateway URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace helm-test -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace helm-test port-forward $POD_NAME 9091

For more information on running Prometheus, visit:
https://prometheus.io/

動作確認

上の出力に書かれている通りのコマンドを実行

export POD_NAME=$(kubectl get pods --namespace helm-test -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace helm-test port-forward $POD_NAME 9090

localhost:9090にアクセスするとPrometheusが表示できた
prometheus.png

追記

Helm v3でCRD使えないバグに遭遇

試しにPrometheus Operatorを入れようとしたところ、下記のように怒られた

helm install  stable/prometheus-operator --generate-name
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(MutatingWebhookConfiguration.webhooks[0].clientConfig): missing required field "caBundle" in io.k8s.api.admissionregistration.v1beta1.WebhookClientConfig

下記のIssueが上がってたので、Helm v2に戻そうと思いました
https://github.com/datawire/ambassador/issues/2057

29
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?