helm:Error: could not find tiller

Given the information as follows:
root@8:~# helm version
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Error: could not find tiller
root@8:~# ./get_helm.sh --version v2.14.1
Downloading https://get.helm.sh/helm-v2.14.1-linux-amd64.tar.gz
Preparing to install helm and tiller into /usr/local/bin
helm installed into /usr/local/bin/helm
tiller installed into /usr/local/bin/tiller
Run 'helm init' to configure helm.
root@8:~# helm init
Creating /root/.helm 
Creating /root/.helm/repository 
Creating /root/.helm/repository/cache 
Creating /root/.helm/repository/local 
Creating /root/.helm/plugins 
Creating /root/.helm/starters 
Creating /root/.helm/cache/archive 
Creating /root/.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 /root/.helm.
Error: error installing: the server could not find the requested resource

For more than v1.16.0 version Kubernetes, there may be encountered Error: error installing: the server could not find the requested resource error. This is due to extensions / v1beta1 has been replaced apps / v1. I believe in the released version 2.15 or 3, you should not encounter this problem. Or ecological reasons for relatively slow.

The solution is to use a statement like installation
helm init -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.3 --stable-repo-url http://mirror.azure.cn/kubernetes/charts/ --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' | kubectl apply -f -

Provided --tiller-image --service-account parameters mounted helm

Check is not installed successfully
kubectl get pods -n kube-system | grep tiller

root@rancherk8sm1:~# helm version
Client: &version.Version{SemVer:"v2.12.1", GitCommit:"02a47c7249b1fc6d8fd3b94e6b4babf9d818144e", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.12.1", GitCommit:"02a47c7249b1fc6d8fd3b94e6b4babf9d818144e", GitTreeState:"clean"}

Replace repo Ali mirror, note that the above command has been done this far, so I do not do it. Here is a case not yet replaced repo and repo introduction of how to replace.

root@rancherk8sm1:~# helm repo list
NAME    URL
stable  https://kubernetes-charts.storage.googleapis.com
local   http://127.0.0.1:8879/charts

root@rancherk8sm1:~# helm repo remove stable
"stable" has been removed from your repositories

root@rancherk8sm1:~# helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
"stable" has been added to your repositories
root@rancherk8sm1:~# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈

root@rancherk8sm1:~# helm repo list
NAME    URL
local   http://127.0.0.1:8879/charts
stable  https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
root@rancherk8sm1:~#

###########################################################
###########################################################

1. Install the client Helm

One way:
public cloud environment can use the official script to install a key to install, just execute the following commands:

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get |bash

Second way:
within the network environment can manually download and install, download address: https: //github.com/kubernetes/helm/releases

tar -zxvf helm-2.14.1.tar.gz
mv helm-2.14.1/helm /usr/local/bin/helm

Execute command to verify the helm version:
can only view the version of the client, the server has not been installed

[root@master1 helm]# helm version
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Error: could not find a ready tiller pod

bash command to install the helm of completion script:

helm completion bash > .hermrc ;echo "source .helmrc" >> .bashrc
2. Install the server Tiller

Under normal circumstances helm init to perform,
but in 1.16.0 and later versions kubernetes execution was reported the following error:

helm init
$HELM_HOME has been configured at /root/.helm.
Error: error installing: the server could not find the requested resource

The reason is because apiversion the deployment after 1.16.0 endpoint changes need to be processed as follows:

Output tiller definition files

> helm init --output yaml > tiller.yaml
#修改定义文件 apiVersion改为apps/v1,并新增selector信息 如下:
> vim tiller.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
...
#修改后执行定义文件
> kubectl apply -f tiller.yaml

After performed using helm version and found a server has been installed successfully:

>  helm version
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}

Execution helm list found still being given as follows:

> helm list   
Error: configmaps is forbidden: User "system:serviceaccount:kube-system:default" cannot list resource "configmaps" in API group "" in the namespace "kube-system"

Execute the following command:

# 在kube-system命名空间中创建tiller账户
kubectl create serviceaccount --namespace kube-system tiller
# 创建角色并授予cluster-admin权限
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
#使用 kubectl patch 更新 API 对象
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'      
helm init --service-account tiller --upgrade
# 指定账户进行初始化,别忘了还要指定tiller镜像哦
helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' | kubectl apply -f -

After performing tiller successful installation.

Note: For this error Error: error installing: the server could not find the requested resource
can directly use the following command to solve, it will not report rbacx related mistake.

helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' | kubectl apply -f -
Published 33 original articles · won praise 0 · Views 3915

Guess you like

Origin blog.csdn.net/erhaiou2008/article/details/104014183