关于 Helm v3 我们遇到的问题总结如下

Helm 最近刚刚进行了一次重大版本更新(2019/11/13)。

Helm v3 已发布: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会作为图表和配置的发布管理工具,但看了下面的发布说明,发现「Tiller的主要目的可以在没有Tiller的情况下实现」,似乎不再需要Tiller了。

移除Tiller:https://helm.sh/docs/faq/#removal-of-tiller

Release的名称与命名空间相关联。

以前,即使命名空间不同,也不能使用相同的发布名称,这是一种限制和困扰。
然而,由于发布现在被限定在命名空间范围内,每个命名空间都可以拥有同名的发布。
当然,还可以像下面这样引用其他命名空间中的发布。

helm list --namespace foo

Helm的安装和配置

查看 Helm 的 GitHub 存储库,然后进行了存储库的添加。

安装Helm

brew install kubernetes-helm

图表获取使用存储库的设置

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

创建一个适当的命名空间

kubectl create namespace helm-test

获取合适的图表(在这里使用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
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

由於提到以下問題,我打算回到Helm v2。
https://github.com/datawire/ambassador/issues/2057

广告
将在 10 秒后关闭
bannerAds