k8s helm安装Tiller出错解决

安装Helm

安装Helm通常使用一下命令:

bash 复制代码
[root@k8s-master ~]# curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6875  100  6875    0     0   1232      0  0:00:05  0:00:05 --:--:--  1807
Downloading https://get.helm.sh/helm-v2.17.0-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.

安装完成会提示执行helm init安装tiller ,但是有时间镜像会很慢,所以选择手动安装tiller 。

bash 复制代码
root@k8s-master helm]# helm init --upgrade --tiller-image registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.16.9

此时执行helm list坑出现了,版本不匹配。

bash 复制代码
[root@k8s-master ~]# helm list
Error: incompatible versions client[v2.17.0] server[v2.16.9]

处理

我选择了升级版本

bash 复制代码
[root@k8s-master ~]# helm init --upgrade --tiller-image registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.17.0
$HELM_HOME has been configured at /root/.helm.

Tiller (the Helm server-side component) has been updated to registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.17.0 .

到那时查看pod是会发现ErrImagePull,ImagePullBackOff,查看一下pod。

bash 复制代码
[root@k8s-master ~]# kubectl get pods -n kube-system
NAME                                 READY   STATUS         RESTARTS   AGE
tiller-deploy-54cb5b4ff9-tgz8c       0/1     ErrImagePull   0          50s

查看tiller-deploy-54cb5b4ff9-tgz8c pod日志信息

bash 复制代码
[root@k8s-master ~]# kubectl describe pod tiller-deploy-54cb5b4ff9-tgz8c  -n kube-system

Events:
  Type     Reason     Age                From                Message
  ----     ------     ----               ----                -------
  Normal   Scheduled  <unknown>          default-scheduler   Successfully assigned kube-system/tiller-deploy-54cb5b4ff9-tgz8c to k8s-node1
  Normal   Pulling    15s (x3 over 72s)  kubelet, k8s-node1  Pulling image "registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.17.0"
  Warning  Failed     13s (x3 over 57s)  kubelet, k8s-node1  Failed to pull image "registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.17.0": rpc error: code = Unknown desc = Error response from daemon: manifest for registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.17.0 not found: manifest unknown: manifest unknown
  Warning  Failed     13s (x3 over 57s)  kubelet, k8s-node1  Error: ErrImagePull
  Normal   BackOff    2s (x3 over 57s)   kubelet, k8s-node1  Back-off pulling image "registry.cn-beijing.aliyuncs.com/google_registry/tiller:v2.17.0"
  Warning  Failed     2s (x3 over 57s)   kubelet, k8s-node1  Error: ImagePullBackOff

解决

1.删除tiller deployment,顺带会一起删除tiller pod

bash 复制代码
kubectl delete -n kube-system deployment tiller-deploy

2.删除完再执行helm init,发现提示已安装

bash 复制代码
[root@k8s-master ~]# helm init --service-account=tiller --tiller-image=registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.17.0   --history-max 300
$HELM_HOME has been configured at /root/.helm.
Warning: Tiller is already installed in the cluster.
(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)

3.再次执行helm reset --force卸载tiller

bash 复制代码
[root@k8s-master ~]# helm reset --force
Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.
[root@k8s-master ~]# helm init --service-account=tiller --tiller-image=registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.17.0   --history-max 300
$HELM_HOME has been configured at /root/.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://v2.helm.sh/docs/securing_installation/

4.再次查询版本信息,发现已经不报错了。

bash 复制代码
[root@k8s-master ~]# helm version
Client: &version.Version{SemVer:"v2.17.0", GitCommit:"a690bad98af45b015bd3da1a41f6218b1a451dbe", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.17.0", GitCommit:"a690bad98af45b015bd3da1a41f6218b1a451dbe", GitTreeState:"clean"}

5.安装mysql报错

bash 复制代码
[root@k8s-master ~]# helm install stable/mysql
Error: validation failed: unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1"

解决方案更换镜像源 helm repo add stable http://mirror.azure.cn/kubernetes/charts/

相关推荐
容器魔方21 分钟前
华为云亮相 KubeCon China 2025,开源生态引领 AI 时代技术跃迁
云原生·容器·云计算
老兵发新帖4 小时前
Kubernetes架构解析
容器·架构·kubernetes
字节跳动开源4 小时前
Gödel Rescheduler:适用于云原生系统的全局最优重调度框架
云原生
星辰大海的精灵5 小时前
轻松玩转 Kubernetes 集群的工具包
后端·架构·kubernetes
容器魔方1 天前
Volcano v1.12 正式发布!驱动云原生AI与批量计算向智能高效新阶段演进
云原生·容器·云计算
Johny_Zhao1 天前
CentOS Stream 8 高可用 Kuboard 部署方案
linux·网络·python·网络安全·docker·信息安全·kubernetes·云计算·shell·yum源·系统运维·kuboard
在未来等你1 天前
互联网大厂Java求职面试:云原生架构与微服务设计中的复杂挑战
java·微服务·ai·云原生·秒杀系统·rag·分布式系统
爱瑞瑞1 天前
云原生学习笔记(八) Docker 实战:宿主机与容器的信息交互与共享策略
docker·容器
程序员老乔1 天前
【Dify系列】【一】【安装与部署】【ubuntu22.04安装docker部署dify1.4.2】
运维·docker·容器
exe4521 天前
使用docker中的ollama
运维·docker·容器