Helm: Helm初始化文件在Kubernetes 1.16.0中

创建于 2019-09-06  ·  83评论  ·  资料来源: helm/helm

helm version :v2.14.3
kubectl version :客户端:v1.15.3,服务器:v1.16.0-rc.1
云提供商/平台(AKS,GKE,Minikube等):IBM Cloud Kubernetes服务

$ helm init --service-account tiller
$HELM_HOME has been configured at /Users/xxxx/.helm.
Error: error installing: the server could not find the requested resource

$ helm init --debug --service-account tiller
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
. 
.
.

似乎舵正在尝试使用以下命令创建tiller部署: apiVersion: extensions/v1beta1
根据: https :
不再受支持。

最有用的评论

以下sed为我工作:

helm init --service-account tiller --output yaml | sed 's<strong i="6">@apiVersion</strong>: extensions/v1beta1<strong i="7">@apiVersion</strong>: apps/v1@' | sed 's@  replicas: 1@  replicas: 1\n  selector: {"matchLabels": {"app": "helm", "name": "tiller"}}@' | kubectl apply -f -

@mattymo解决方案(使用kubectl补丁--local)的问题是,当其输入包含多个资源(此处为Deployment和Service)时,它似乎不起作用。

所有83条评论

由于过去需要helm init --upgrade协调extensions/v1beta1apps/v1分er部署,因此复杂性使得我们过去避免将分er更新为apps / v1。 看起来一旦我们开始支持Kubernetes 1.16.0,我们将不得不继续处理这种情况并迁移到较新的apiVersion。

这是一个短期解决方法:

helm init --output yaml | sed 's<strong i="6">@apiVersion</strong>: extensions/v1beta1<strong i="7">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

实际上,这还不够好。 我仍然收到错误消息:

error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec

可以使用以下方法进行修补:

/usr/local/bin/kubectl patch --local -oyaml -f - -p '{"spec":{"selector": {"app":"helm","name":"tiller"}}}'

好的! 使用--override标志可能比疯狂的sed hack达到相同的效果:)

好的! 使用--override标志可能比疯狂的sed hack达到相同的效果:)

是的,但是我可以复制并粘贴他疯狂的sed hacks,但是此helm init --override "apiVersion"="apps/v1"不能正常工作。 好的,sed hack也不起作用。

当前的解决方法似乎是这样的:

helm init-输出yaml> tiller.yaml
并更新tiller.yaml:

  • 更改为apps / v1
  • 添加选择器字段
---
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: helm
      name: tiller
....

以下sed为我工作:

helm init --service-account tiller --output yaml | sed 's<strong i="6">@apiVersion</strong>: extensions/v1beta1<strong i="7">@apiVersion</strong>: apps/v1@' | sed 's@  replicas: 1@  replicas: 1\n  selector: {"matchLabels": {"app": "helm", "name": "tiller"}}@' | kubectl apply -f -

@mattymo解决方案(使用kubectl补丁--local)的问题是,当其输入包含多个资源(此处为Deployment和Service)时,它似乎不起作用。

Kubernetes 1.16.0于昨天发布:9/18/2018。
除非使用上述解决方法,否则Helm在此最新的Kubernetes版本中已损坏。

什么时候可以解决此问题,何时释放Helm 2.15.0

如果您想少用一个sed :)
helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="6">@apiVersion</strong>: extensions/v1beta1<strong i="7">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

谢谢!

今天,我遇到了同样的问题,我自己更改了标签。 我将标签更改为apps/v1并添加selector部分,因为它现在表现出色,以下是我的yaml文件:

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: helm
      name: tiller
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: helm
        name: tiller
    spec:
      automountServiceAccountToken: true
      containers:
      - env:
        - name: TILLER_NAMESPACE
          value: kube-system
        - name: TILLER_HISTORY_MAX
          value: "0"
        image: gcr.io/kubernetes-helm/tiller:v2.14.3
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /liveness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
        - containerPort: 44135
          name: http
        readinessProbe:
          httpGet:
            path: /readiness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        resources: {}
      serviceAccountName: tiller
status: {}

@jbrette你是我的英雄! 我在selector节中苦苦挣扎。

今天,我遇到了同样的问题,我自己更改了标签。 我将标签更改为apps/v1并添加selector部分,因为它现在表现出色,以下是我的yaml文件:

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: helm
      name: tiller
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: helm
        name: tiller
    spec:
      automountServiceAccountToken: true
      containers:
      - env:
        - name: TILLER_NAMESPACE
          value: kube-system
        - name: TILLER_HISTORY_MAX
          value: "0"
        image: gcr.io/kubernetes-helm/tiller:v2.14.3
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /liveness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
        - containerPort: 44135
          name: http
        readinessProbe:
          httpGet:
            path: /readiness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        resources: {}
      serviceAccountName: tiller
status: {}

如何改变 ? 你能描述更多细节吗?

今天,我遇到了同样的问题,我自己更改了标签。 我将标签更改为apps/v1并添加selector部分,因为它现在表现出色,以下是我的yaml文件:

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: helm
      name: tiller
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: helm
        name: tiller
    spec:
      automountServiceAccountToken: true
      containers:
      - env:
        - name: TILLER_NAMESPACE
          value: kube-system
        - name: TILLER_HISTORY_MAX
          value: "0"
        image: gcr.io/kubernetes-helm/tiller:v2.14.3
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /liveness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
        - containerPort: 44135
          name: http
        readinessProbe:
          httpGet:
            path: /readiness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        resources: {}
      serviceAccountName: tiller
status: {}

@ gm12367如何更改,您能否描述更多详细信息?

今天,我遇到了同样的问题,我自己更改了标签。 我将标签更改为apps/v1并添加selector部分,因为它现在表现出色,以下是我的yaml文件:

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: helm
      name: tiller
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: helm
        name: tiller
    spec:
      automountServiceAccountToken: true
      containers:
      - env:
        - name: TILLER_NAMESPACE
          value: kube-system
        - name: TILLER_HISTORY_MAX
          value: "0"
        image: gcr.io/kubernetes-helm/tiller:v2.14.3
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /liveness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
        - containerPort: 44135
          name: http
        readinessProbe:
          httpGet:
            path: /readiness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        resources: {}
      serviceAccountName: tiller
status: {}

@ gm12367如何更改,您能否描述更多详细信息?

例如,您可以使用helm init --service-account tiller --tiller-namespace kube-system --debug打印YAML格式的清单, --debug选项将执行此操作

@ gm12367是的,我可以看到打印内容,但只是输出。 那么,我可以用什么命令更改输出?

@ gm12367我想更改apps / v1并添加选择器部分

@ puww1010我只是将输出重定向到一个文件中,然后使用VIM对其进行更改。 下面的命令作为参考。

# helm init --service-account tiller --tiller-namespace kube-system --debug >> helm-init.yaml
# vim helm-init.yaml
# kubectl apply -f helm-init.yaml

如果您设置了go环境,并且等不及以下解决此问题的PR [与Kubernetes 1.16兼容的头盔初始化]#6462合并,则可以随时执行以下操作:

建造

mkdir p ${GOPATH}/src/k8s.io
cd ${GOPATH}/src/k8s.io 
git clone -b kube16 https://github.com/keleustes/helm.git
cd helm
make bootstrap build

测试:

kubectl version

Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
/bin/helm init --wait --tiller-image gcr.io/kubernetes-helm/tiller:v2.14.3
Creating /home/xxx/.helm
Creating /home/xxx/.helm/repository
Creating /home/xxx/.helm/repository/cache
Creating /home/xxx/.helm/repository/local
Creating /home/xxx/.helm/plugins
Creating /home/xxx/.helm/starters
Creating /home/xxx/.helm/cache/archive
Creating /home/xxx/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /home/xxx/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation

``
kubectl获取deploy.apps / tiller-deploy -n kube-system -o yaml

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2019-09-22T01:01:11Z"
  generation: 1
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
  resourceVersion: "553"
  selfLink: /apis/apps/v1/namespaces/kube-system/deployments/tiller-deploy
  uid: 124001ca-6f31-417e-950b-2452ce70f522
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: helm
      name: tiller
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: helm
        name: tiller
    spec:
      automountServiceAccountToken: true
      containers:
      - env:
        - name: TILLER_NAMESPACE
          value: kube-system
        - name: TILLER_HISTORY_MAX
          value: "0"
        image: gcr.io/kubernetes-helm/tiller:v2.14.3
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /liveness
            port: 44135
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
          protocol: TCP
        - containerPort: 44135
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /readiness
            port: 44135
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2019-09-22T01:01:23Z"
    lastUpdateTime: "2019-09-22T01:01:23Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2019-09-22T01:01:11Z"
    lastUpdateTime: "2019-09-22T01:01:23Z"
    message: ReplicaSet "tiller-deploy-568db6b69f" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

@jbrette按照说明进行操作后仍然遇到相同的问题

@jbrette按照说明进行操作后仍然遇到相同的问题

看起来您键入的是“ helm”,而不是“ ./bin/helm” .....,因此您使用的是旧版本的二进制文件。

成功初始化后,您将无法从存储库中安装图表包,直到也替换其中的extensions / v1beta1为止。
这是如何从存储库中为k8s v1.16.0调整任何图表
该示例基于普罗米修斯图表。

git clone https://github.com/helm/charts
cd charts/stable

将扩展/ v1beta1替换为策略/ v1beta1 PodSecurityPolicy:

sed -i 's<strong i="11">@apiVersion</strong>: extensions/v1beta1<strong i="12">@apiVersion</strong>: policy/v1beta1@' `find . -iregex ".*yaml\|.*yml" -exec awk '/kind:\s+PodSecurityPolicy/ {print FILENAME}' {} +`

_helpers.tpl对于使用它的那些图表,NetworkPolicy apiVersion可以很好地处理。

将Deployment / StatefulSet,ReplicaSet,DaemonSet中的extensions / v1beta1替换为apps / v1

sed -i 's<strong i="17">@apiVersion</strong>: extensions/v1beta1<strong i="18">@apiVersion</strong>: apps/v1@' `find . -iregex ".*yaml\|.*yml" -exec awk '/kind:\s+(Deployment|StatefulSet|ReplicaSet|DaemonSet)/ {print FILENAME}' {} +`
sed -i 's<strong i="19">@apiVersion</strong>: apps/v1beta2<strong i="20">@apiVersion</strong>: apps/v1@' `find . -iregex ".*yaml\|.*yml" -exec awk '/kind:\s+(Deployment|StatefulSet|ReplicaSet|DaemonSet)/ {print FILENAME}' {} +`

创建一个新包:

helm package ./prometheus
Successfully packaged chart and saved it to: /home/vagrant/charts/stable/prometheus-9.1.1.tgz

安装它:
helm install /home/vagrant/charts/stable/prometheus-9.1.1.tgz

基于https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/

PS对于某些具有依赖关系的图表,您可能需要使用helm dependency update并将依赖的tgz替换为已修补的tgz(如果适用)。

运行helm init --history-max 200时遇到相同的错误

输出

$HELM_HOME has been configured at /Users/neil/.helm.
Error: error installing: the server could not find the requested resource
$ helm version
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Error: could not find tiller

该分支工作https://github.com/keleustes/helm/tree/kube16。 您可以自己建立分支。 为了方便起见,我还在此处上传了二进制文件https://s3-us-west-2.amazonaws.com/bin.cryptexlabs.com/github.com/keleustes/helm/kube16/darwin/helm。 一个警告是您必须使用canary图像标志helm init --canary-image因为该版本尚未发布

您不需要金丝雀形象就可以完成这项工作。 我会建议使用helm init --tiller-image gcr.io/kubernetes-helm/tiller:v2.14.3@jbrette前面所提到的,如果你想尝试#6462。

我建议用户先尝试先提供的一种变通办法,然后再尝试PR。 这样,他们可以继续使用Helm 2.14.3,而不是仍在审查中的自定义dev分支。

当我执行命令时,它会部署它,但是之后可以在pods中看到它,并说服务器错误(NotFound):未找到pods“ tiller-deploy”

helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="7">@apiVersion</strong>: extensions/v1beta1<strong i="8">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

Deployment.apps / tiller-deploy已创建
服务/分iller部署已创建

但是当我做kubectl获得豆荚时-所有命名空间都看不到豆荚
名称空间名称就绪状态重启年龄
kube-system coredns-5644d7b6d9-559hw 1/1运行0 23h
kube-system coredns-5644d7b6d9-xcmjd 1/1运行中0 23h
kube-system etcd-fmp 1/1运行0 24h
kube-system kube-apiserver-fmp 1/1运行中0 24h
kube-system kube-controller-manager-fmp 1/1运行1 24小时
kube-system kube-flannel-ds-amd64-ffx2g 1/1运行中0 23h
kube-system kube-proxy-lfvrz 1/1运行中0 24h
kube-system kube-scheduler-fmp 1/1运行中0 24h

kubectl获取所有--all-namespaces | grep分er
kube系统服务/分t部署ClusterIP xxx44134 / TCP 2分52秒
kube-system deployment.apps / tiller-deploy 0/1 0 0 2m54s
kube系统copysetset.apps / tiller-deploy-77855d9dcf 1 0 0 2m54s

@DanielIvaylov我想您没有分

谢谢!

@DanielIvaylov我想您没有分

谢谢!

抱歉,我新来的要开始了。 我如何启动分till服务帐户?

@丹尼尔·伊瓦伊洛夫(DanielIvaylov)

kubectl --namespace kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller

将以下标志添加到api服务器(/etc/kubernetes/manifests/kube-apiserver.yaml)中,以临时重新启用那些已弃用的API。

--runtime-config = apps / v1beta1 = true,apps / v1beta2 = true,扩展名/ v1beta1 / daemonsets = true,扩展名/ v1beta1 / deployments = true,扩展名/ v1beta1 / replicasets = true,扩展名/ v1beta1 / networkpolicies = true, extensions / v1beta1 / podsecuritypolicies = true

这修复了头盔v2

对于使用Windows的用户,我们可以通过powershell安装/升级分till,如下所示:

$(helm init --output yaml) -replace "extensions/v1beta1","apps/v1"

这是一个短期解决方法:

helm init --output yaml | sed 's<strong i="7">@apiVersion</strong>: extensions/v1beta1<strong i="8">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

实际上,这还不够好。 我仍然收到错误消息:

error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec

可以使用以下方法进行修补:

/usr/local/bin/kubectl patch --local -oyaml -f - -p '{"spec":{"selector": {"app":"helm","name":"tiller"}}}'

对我来说,kubectl补丁正在挂起
/ var / log / syslog文件中没有消息

服务帐户已经存在

kubeflow @ masternode :〜$ kubectl --namespace kube-system创建一个耕er
服务器错误(AlreadyExists):服务帐户“分iller”已经存在
kubeflow @ masternode :〜$ kubectl创建clusterrolebinding耕种机--clusterrole cluster-admin --serviceaccount = kube- system:tiller
来自服务器的错误(已存在):clusterrolebindings.rbac.authorization.k8s.io“ tiller”已经存在

你能给些建议么

执行以下

导出PATH = $ PATH:/ usr / local / bin
掌舵
哪个分er
掌舵安装
--name nfs-client-provisioner \
--set nfs.server = 10.0.0.4 \
--set nfs.path = / nfsroot \
--set storageClass.name = nfs \
--set storageClass.defaultClass = true \
稳定/ NFS客户端供应商

返回与

/ usr / local / bin / helm
/ usr / local / bin / tiller
错误:找不到分er

感谢您的任何帮助,因为这现在已成为秀场停止

@cyrilthank似乎分er部署,请尝试运行以下命令来安装分till:
helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="7">@apiVersion</strong>: extensions/v1beta1<strong i="8">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

如果服务器正常运行, helm version -s应该返回服务器(分iller器)版本

谢谢你,先生。
您在使我们继续进行kubeflow到下一步骤方面有所帮助

好的,现在我想我遇到了这个问题
https://github.com/kubeflow/kubeflow/issues/4184
回到作为阻碍

如果您可以就如何在https://github.com/kubeflow/kubeflow/issues/4184上获得一些帮助的建议提供帮助,请多加赞赏

@cyrilthank尝试上面提供的步骤: https :
您需要使用新版本替换不推荐使用的api版本

kubeflow_workaround_and_error_traces.txt

主席先生,谢谢您的耐心回复,特别是在保持此问题公开性方面

抱歉,但是看来我在解决方法步骤中做错了

赞赏您是否可以查看所附跟踪中的步骤,并就我做错了事向我提出建议

@cyrilthank,您只需要对sed命令,用新的api扩展替换旧的api扩展(根本不需要部署prometheus😆)。 对不起,如果我没有表现出足够的自我。
该修补程序基本上是在kubeflow dpl yamls中用apps/v1替换extensions/v1beta1

啊,所以我做了一个哑本:(

我的KFAPP = / nfsroot / kf-poc

我似乎仍然收到一些消息,并且最后出现了错误

您能帮忙吗,因为我现在依赖您转到kubeflow的下一步

kubeflow_workaround_sed_and_error_traces.txt

@cyrilthank,您只需要对sed命令,用新的api扩展替换旧的api扩展(无需部署prometheus即可)。 对不起,如果我没有表现出足够的自我。
该修补程序基本上是在kubeflow dpl yamls中用apps/v1替换extensions/v1beta1

apps/v1beta2也和apps/v1

https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/

非常感谢@uniuuu的帮助
您能否建议在哪里/如何获取https://github.com/helm/helm/files/3662328/kubeflow_workaround_sed_and_error_traces.txt中引用的yaml文件

https://github.com/helm/helm/issues/6374#issuecomment -533840097
https://github.com/helm/helm/issues/6374#issuecomment -533185074

请求,因为在进行sed更改后,我们仍然遇到了引用的错误

您能告诉我是否要执行此步骤吗

kubectl转换-f-输出版本/

需要为每个执行是KFAPP位置中的每个yaml文件,包括.kache

如果您在使用helm init时应用了上述解决方法,而在尝试诸如helm version类的操作时仍然出现以下错误,那是因为helm deployment找不到。

Error: could not find tiller

您需要运行kubectl get events --all-namespaces | grep -i tiller才能知道为什么它还没有准备好。

例如,我的问题很简单,如下所示,因为我不需要serviceaccount "tiller"microk8s

microk8s.kubectl get events --all-namespaces | grep -i tiller
kube-system    23m         Warning   FailedCreate                   replicaset/tiller-deploy-77855d9dcf            Error creating: pods "tiller-deploy-77855d9dcf-" is forbidden: error looking up service account kube-system/tiller: serviceaccount "tiller" not found

所以我在没有服务帐户的情况下进行了工作

- helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="20">@apiVersion</strong>: extensions/v1beta1<strong i="21">@apiVersion</strong>: apps/v1@' | kubectl apply -f -
+ helm init spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="22">@apiVersion</strong>: extensions/v1beta1<strong i="23">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

@cyrilthank我删除了您的评论,因为它与此处涉及的讨论无关。 请继续在kubeflow / kubeflow#4184中进行跟进。 谢谢!

helm init spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="6">@apiVersion</strong>: extensions/v1beta1<strong i="7">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

轻微校正

helm init --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="11">@apiVersion</strong>: extensions/v1beta1<strong i="12">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

+1

@ puww1010我只是将输出重定向到一个文件中,然后使用VIM对其进行更改。 下面的命令作为参考。

# helm init --service-account tiller --tiller-namespace kube-system --debug >> helm-init.yaml
# vim helm-init.yaml
# kubectl apply -f helm-init.yaml

我尝试这样做。 在VIM中编辑文件后,我使用kubectl apply命令,但是它似乎没有任何作用。 当我再次运行helm init --service-account tiller --tiller-namespace kube-system --debug >> helm-init.yamlhelm init --output yaml ,尚未应用更改。 还有其他人遇到吗?

如果您想少用一个sed :)
helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's<strong i="7">@apiVersion</strong>: extensions/v1beta1<strong i="8">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

谢谢!

我刚刚升级了我们的k8s,遇到了这个问题,我使用了上面的解决方案。 它创建了部署,但是copysetset失败了,这就是我从kubectl describe -n kube-system replicasets.apps tiller-deploy-77855d9dcf

Events:
  Type     Reason        Age                 From                   Message
  ----     ------        ----                ----                   -------
  Warning  FailedCreate  41s (x14 over 82s)  replicaset-controller  Error creating: pods "tiller-deploy-77855d9dcf-" is forbidden: error looking up service account kube-system/tiller: serviceaccount "tiller" not found

在哪里可以找到创建该服务帐户的Yaml文件?

@丹尼尔·伊瓦伊洛夫(DanielIvaylov)

kubectl --namespace kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller

这解决了我的问题!

6462已被合并,并将在下一版本(2.15.0)中可用。 现在,随时使用上面提供的解决方法或使用canary release

谢谢大家!

除非尚未进行合并,否则Canary图片仍然会产生相同的错误,

@ puww1010我只是将输出重定向到一个文件中,然后使用VIM对其进行更改。 下面的命令作为参考。

# helm init --service-account tiller --tiller-namespace kube-system --debug >> helm-init.yaml
# vim helm-init.yaml
# kubectl apply -f helm-init.yaml

我尝试这样做。 在VIM中编辑文件后,我使用kubectl apply命令,但是它似乎没有任何作用。 当我再次运行helm init --service-account tiller --tiller-namespace kube-system --debug >> helm-init.yamlhelm init --output yaml ,尚未应用更改。 还有其他人遇到吗?

是的,对我来说也是如此。

您可能需要将图像位置更改为gcr.azk8s.cn/kubernetes-helm/tiller:v2.14.3gcr.io位置似乎已被阻止。

您可能需要将映像位置更改为gcr.azk8s.cn/kubernetes-helm/tiller:v2.14.3,gcr.io的位置似乎已被阻止。

尽管这是一个完全有效的问题,但该问题与本问题中存在的问题略有正交,但是不幸的是, gcr.io在中国被屏蔽了。 有关更多信息,请参见https://github.com/helm/charts/issues/14607

我们已经能够通过将kubernetes版本回滚到1.15.4来解决此问题

感谢@UmamaheshMaxwell分享。

您能否分享您用于回滚kubernetes版本的步骤?

@cyrilthank(如果是minikube), minikube config set kubernetes-version v1.15.4

感谢@UmamaheshMaxwell分享。

您能否分享您用于回滚kubernetes版本的步骤?

@cyrilthank我们一直在使用我们自己的VM(Ubuntu 18+),下面是安装k8s版本1.15.4 setps。

  1. kubeadm重置
  2. sudo apt-get install kubelet = 1.15.4-00 kubectl = 1.15.4-00 kubeadm = 1.15.4-00
  3. sudo kubeadm init --pod-network-cidr = 10.244.10.0 / 16 --apiserver-advertise-address = xxxx --apiserver-cert-extra-sans = xxxx --kubernetes-version“ 1.15.4”

--pod-network-cidr=10.244.10.0/16 -法兰绒
--apiserver-advertise-address=x.x.x.x -虚拟机的私有IP(主服务器)
--apiserver-cert-extra-sans=x.x.x.x -VM的公共IP(主机)(如果您试图从本地计算机访问主机,则这是必需的。

注意:请点击以下链接为自托管的Kubernetes集群设置kubeconfig文件(http://docs.shippable.com/deploy/tutorial/create-kubeconfig-for-self-hosted-kubernetes-cluster/)

让我知道您是否还有任何疑问。

@cyrilthank(如果是minikube),则minikube配置设置为kubernetes-version v1.15.4

谢谢@MrSimonEmms我的世界不是迷你的,我想我必须遵循@UmamaheshMaxwell的步骤

感谢@UmamaheshMaxwell分享。
您能否分享您用于回滚kubernetes版本的步骤?

@cyrilthank我们一直在使用我们自己的VM(Ubuntu 18+),以下是安装k8s版本1.15.4的setps

kubeadm重置
sudo apt-get install kubelet = 1.15.4-00 kubectl = 1.15.4-00 kubeadm = 1.15.4-00
sudo kubeadm init --pod-network-cidr = 10.244.10.0 / 16 --apiserver-advertise-address = xxxx --apiserver-cert-extra-sans = xxxx --kubernetes-version“ 1.15.4”

--pod-network-cidr = 10.244.10.0 / 16-法兰绒
--apiserver-advertise-address = xxxx-VM的私有IP(Master)
--apiserver-cert-extra-sans = xxxx-VM的公共IP(主服务器)(如果要从本地计算机访问主服务器,则这是必需的。
注意:请点击以下链接为自托管的Kubernetes集群设置kubeconfig文件(http://docs.shippable.com/deploy/tutorial/create-kubeconfig-for-self-hosted-kubernetes-cluster/)
让我知道您是否还有任何疑问。

感谢@UmamaheshMaxwell的耐心回复

我有一个现有的kubernetes 1.16安装程序,请确认我是否可以尝试运行这些步骤?

感谢@UmamaheshMaxwell分享。
您能否分享您用于回滚kubernetes版本的步骤?
@cyrilthank我们一直在使用我们自己的VM(Ubuntu 18+),以下是安装k8s版本1.15.4的setps
kubeadm重置
sudo apt-get install kubelet = 1.15.4-00 kubectl = 1.15.4-00 kubeadm = 1.15.4-00
sudo kubeadm init --pod-network-cidr = 10.244.10.0 / 16 --apiserver-advertise-address = xxxx --apiserver-cert-extra-sans = xxxx --kubernetes-version“ 1.15.4”
--pod-network-cidr = 10.244.10.0 / 16-法兰绒
--apiserver-advertise-address = xxxx-VM的私有IP(Master)
--apiserver-cert-extra-sans = xxxx-VM的公共IP(主服务器)(如果要从本地计算机访问主服务器,则这是必需的。
注意:请点击以下链接为自托管的Kubernetes集群设置kubeconfig文件(http://docs.shippable.com/deploy/tutorial/create-kubeconfig-for-self-hosted-kubernetes-cluster/)
让我知道您是否还有任何疑问。

感谢@UmamaheshMaxwell的耐心回复

我有一个现有的kubernetes 1.16安装程序,请确认我是否可以尝试运行这些步骤?

是的@cyrilthank ,即使我们有kubernetes 1.16.1,但我们也必须将其回滚到1.15.4 ,如果您想从头开始设置它,则下面是链接。

虚拟机的操作系统版本

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic

清理kuberenetes

kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*   
sudo apt-get autoremove  
sudo rm -rf ~/.kube

设置Kubernetes (_Master和Node_)
https://www.howtoforge.com/tutorial/how-to-install-kubernetes-on-ubuntu/
(您最好尽可能自动执行上面链接中建议的步骤,以节省时间)

让我知道您是否仍然需要任何进一步的帮助。 祝您旅途愉快,:),希望您旅途愉快。

您可能需要将映像位置更改为gcr.azk8s.cn/kubernetes-helm/tiller:v2.14.3,gcr.io的位置似乎已被阻止。

尽管这是一个完全有效的问题,但该问题与本问题中存在的问题略有正交,但是不幸的是, gcr.io在中国被屏蔽了。 有关更多信息,请参见helm / charts#14607

我不在中国,但在美国。 但是我认为我的VPN阻止了该站点。 无论如何,我遵循了该线程中概述的所有步骤,直到尝试手动获取图像并看到它没有响应之前,它才能正常工作,以防万一其他人被卡在同一位置时,可以尝试其他方法。我。

我也收到错误:

$ helm init
$HELM_HOME has been configured at C:\Users\user\.helm.
Error: error installing: the server could not find the requested resource

我想在这个问题上,特别是提出了解决这一个。 但是,在相应地修改了tiller.yaml文件之后,我无法更新配置。 我正在尝试以下命令以应用更改/更新配置:

$ kubectl apply -f tiller.yaml
deployment.apps/tiller-deploy configured
service/tiller-deploy configured

但是然后,如果我运行:

$ helm init --output yaml > tiller2.yaml

tiller2.yaml文件显示:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  template:

基本上,更改不会反映出来。 因此,我假设我没有正确更新配置。 正确的方法是什么?


编辑:我设法使其运行。 我正在使用Minikube,为了使其运行,首先我将Kubernetes版本降级到1.15.4。

minikube delete
minikube start --kubernetes-version=1.15.4

然后,我使用了代理,因此我不得不将Minikube的IP添加到NO_PROXY列表中:本例中192.168.99.101 。 参见: https :

注意:经过一些进一步的测试,也许降级不是必需的,也许我所缺少的只是NO_PROXY步骤。 我将所有192.168.99.0/24192.168.39.0/2410.96.0.0/12到NO_PROXY设置中,现在看来一切正常。

helm init --service-accounter --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm'--output yaml |复制代码 sed 's @ apiVersion :扩展名/ v1beta1 @ apiVersion :apps / v1 @'| kubectl适用-f-

它为我工作,非常感谢

随着Kubernetes API的发展,API会定期进行重组或升级。 随着API的发展,旧的API会被弃用并最终被删除。

v1.16版本将停止提供以下不推荐使用的API版本,而支持更新和更稳定的API版本:

NetworkPolicy (in the extensions/v1beta1 API group)
    Migrate to use the networking.k8s.io/v1 API, available since v1.8. Existing persisted data can be retrieved/updated via the networking.k8s.io/v1 API.
PodSecurityPolicy (in the extensions/v1beta1 API group)
    Migrate to use the policy/v1beta1 API, available since v1.10. Existing persisted data can be retrieved/updated via the policy/v1beta1 API.
DaemonSet, Deployment, StatefulSet, and ReplicaSet (in the extensions/v1beta1 and apps/v1beta2 API groups)
    Migrate to use the apps/v1 API, available since v1.9. Existing persisted data can be retrieved/updated via the apps/v1 API.

v1.20发行版将停止提供以下不推荐使用的API版本,而支持更新和更稳定的API版本:

Ingress (in the extensions/v1beta1 API group)
    Migrate to use the networking.k8s.io/v1beta1 API, serving Ingress since v1.14. Existing persisted data can be retrieved/updated via the networking.k8s.io/v1beta1 API.

该怎么办

  • 更改YAML文件以引用较新的API
  • 更新自定义集成和控制器以调用较新的API
  • 更新第三方工具(入口控制器,连续交付系统)以调用较新的API

参考:

作为使用minikube的掌舵人n00b,我能够通过设置kubernetes版本来解决此问题,如下所示:

$ minikube delete
$ minikube start --kubernetes-version=1.15.4

希望能帮助到你!

@PierreF我将您的解决方案(https://github.com/helm/helm/issues/6374#issuecomment-533186177)与k8s v1.16.1和helm v2.15.0一起使用,但分till无法正常工作。

Readiness probe failed: Get http://10.238.128.95:44135/readiness: dial tcp 10.238.128.95:44135: connect: connection refused

@ joshprzybyszewski-wf我使用以下命令

minikube start --memory=16384 --cpus=4 --kubernetes-version=1.15.4
kubectl create -f istio-1.3.3/install/kubernetes/helm/helm-service-account.yaml
helm init --service-account tiller
helm install istio-1.3.3/install/kubernetes/helm/istio-init --name istio-init --namespace istio-system
helm install istio-1.3.3/install/kubernetes/helm/istio --name istio --namespace istio-system

现在,

Error: validation failed: [unable to recognize "": no matches for kind "DestinationRule" in version "networking.istio.io/v1alpha3", unable to recognize "": no matches for kind "DestinationRule" in version "networking.istio.io/v1alpha3", unable to recognize "": no matches for kind "attributemanifest" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "attributemanifest" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "handler" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "handler" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2"]

这是一个短期解决方法:

helm init --output yaml | sed 's<strong i="7">@apiVersion</strong>: extensions/v1beta1<strong i="8">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

实际上,这还不够好。 我仍然收到错误消息:

error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec

可以使用以下方法进行修补:

/usr/local/bin/kubectl patch --local -oyaml -f - -p '{"spec":{"selector": {"app":"helm","name":"tiller"}}}'

您错过了添加macthLabels帖子选择器的机会。

我被转发到@jbrette的解决方案。 这是我跑步时得到的

error: error parsing STDIN: error converting YAML to JSON: yaml: line 11: mapping values are not allowed in this context

此问题已在Helm 2.16.0中修复

我被转发到@jbrette的解决方案。 这是我跑步时得到的

error: error parsing STDIN: error converting YAML to JSON: yaml: line 11: mapping values are not allowed in this context

检查yaml文件,在大多数情况下,引用的行包含{}或[]并在其下定义了其他内容,这会导致错误。 在大多数情况下,问题在于values.yaml之内,否则请检查图表的模板部分。

只是@PierreF@mihivagyok的解决方案的

$ helm repo add companyrepo https://companyrepo
Error: Couldn't load repositories file (/home/username/.helm/repository/repositories.yaml).

我想发生这种情况是因为helm init没有运行,只是生成了yaml文件。 我通过额外运行helm init -c来解决此问题。

在k8s v1.16.6中,掌舵初始化要求spec.selector fyi。

当前的解决方法似乎是这样的:

helm init-输出yaml> tiller.yaml
并更新tiller.yaml:

  • 更改为apps / v1
  • 添加选择器字段
---
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: helm
      name: tiller
....

这是可行的,因为kubernetes将apiVersion apps / v1更改为Deployment,所以需要更改的一件事是我们需要为规范添加选择器matchLabels

另一个解决方法是使用不使用分till的头盔3。

helm init-输出yaml | sed 's @ apiVersion :扩展名/ v1beta1 @ apiVersion :apps / v1 @'| kubectl适用-f-

嗨,在尝试此操作时得到了这个:

jenkins @ jenkin :〜/ .kube $ helm init-输出yaml | sed 's @ apiVersion :扩展名/ v1beta1 @ apiVersion :apps / v1 @'| kubectl适用-f-

找不到命令'kubectl',但可以使用以下命令安装:

快速安装kubectl
请询问您的管理员。

jenkins @ jenkin :〜/ .kube $

helm version :v2.14.3
kubectl version :客户端:v1.15.3,服务器:v1.16.0-rc.1
云提供商/平台(AKS,GKE,Minikube等):IBM Cloud Kubernetes服务

$ helm init --service-account tiller
$HELM_HOME has been configured at /Users/xxxx/.helm.
Error: error installing: the server could not find the requested resource

$ helm init --debug --service-account tiller
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
. 
.
.

似乎舵正在尝试使用以下命令创建tiller部署: apiVersion: extensions/v1beta1
根据: https :
不再受支持。

正在收到此错误:我该如何解决???

root @ jenkin :〜#helm初始化--service-accounter
$ HELM_HOME已在/root/.helm中配置。
错误:安装错误:未知(posts Deployments.extensions)
根@詹金:〜#

这是一个短期解决方法:

helm init --output yaml | sed 's<strong i="7">@apiVersion</strong>: extensions/v1beta1<strong i="8">@apiVersion</strong>: apps/v1@' | kubectl apply -f -

实际上,这还不够好。 我仍然收到错误消息:

error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec

可以使用以下方法进行修补:

/usr/local/bin/kubectl patch --local -oyaml -f - -p '{"spec":{"selector": {"app":"helm","name":"tiller"}}}'

我收到此错误:

jenkins @ jenkin :〜/ .helm $ helm init-输出yaml | sed 's @ apiVersion :扩展名/ v1beta1 @ apiVersion :apps / v1 @'| kubectl适用-f-

找不到命令'kubectl',但可以使用以下命令安装:

快速安装kubectl
请询问您的管理员。

jenkins @ jenkin :〜/ .helm $

解决方法,使用jq

helm init -o json | jq '(select(.apiVersion == "extensions/v1beta1") .apiVersion = "apps/v1")' | jq '(select(.kind == "Deployment") .spec.selector.matchLabels.app = "helm")' | jq '(select(.kind == "Deployment") .spec.selector.matchLabels.name = "tiller")' | kubectl create -f -

解决方法,使用jq

helm init -o json | jq '(select(.apiVersion == "extensions/v1beta1") .apiVersion = "apps/v1")' | jq '(select(.kind == "Deployment") .spec.selector.matchLabels.app = "helm")' | jq '(select(.kind == "Deployment") .spec.selector.matchLabels.name = "tiller")' | kubectl create -f -

您无法使用kubectl create更新资源

@ikarlashov很容易用“ apply”替换“ create”。 上面的一线假设尚未尝试创建资源。

此页面是否有帮助?
0 / 5 - 0 等级