解決K8s報錯:Error: error installing: the server could not find the requested resource


K8s在helm初始化的報錯,我的k8s為1.16.1,用的helm是2.13.1

[root@k8s-master ~]# helm init --service-account tiller --skip-refresh
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

百度了一下,可能是因為版本沖突的原因,於是去github上下了3.0的

 

 其實3.0做了很大的改動,根本不要初始化,還出了一些新特性。

Helm 3.0 已經發布,該版本是 CLI 工具的最新主要版本,主要關注簡單性、安全性和可用性,內容如下:新特性

  • 移除 Tiller(Helm 2 是一種 Client-Server 結構,客戶端稱為 Helm,服務器稱為 Tiller)。Helm 3 只有客戶端結構,客戶端仍稱為 Helm。如下圖所示,它的操作類似於 Helm 2 客戶端,但客戶端直接與 Kubernetes API 服務器交互。

  • 支持 Helm 圖表新版本

  • 支持庫圖表

  • Release 以新格式存儲

  • 支持在 OCI 注冊表中存儲 Helm 圖表(實驗性)

  • 現在可以根據 JSON 模式驗證圖表提供的值

  • 支持 XDG 基目錄規范

  • 不需要初始化 Helm

  • 改進版本升級策略

  • 簡化 CRD 支持

  • Helm 測試框架更新

  • 仍支持 Helm 2 接口

更改存儲庫 

Helm 3 改進了存儲庫的體驗。在 Helm 2 中,默認情況下包含圖表存儲庫。在 Helm 3 中,默認情況下不包含任何存儲庫。因此,你首先需要做的事情之一就是添加一個存儲庫。

與 Helm 2 兼容

Helm 3 引入一個新的 Chart 版本 (v2)。在大多數情況下,在 Helm 2  的圖表在 Helm 3  同樣可用。

於是重新下了一個2.15的,然后就可以了

[root@k8s-master helm]# ll
總用量 58188
-rw-r--r-- 1 root root 22949819 1月   5 20:58 helm-v2.13.1-linux-amd64.tar.gz
-rw-r--r-- 1 root root 24525846 1月   5 22:46 helm-v2.15.2-linux-amd64.tar.gz
-rw-r--r-- 1 root root 12101232 1月   5 22:10 helm-v3.0.2-linux-amd64.tar.gz
-rw-r--r-- 1 root root      354 1月   5 22:39 rbac.yaml
[root@k8s-master helm]# tar -zvxf helm-v2.15.2-linux-amd64.tar.gz
linux-amd64/
linux-amd64/tiller
linux-amd64/helm
linux-amd64/README.md
linux-amd64/LICENSE
[root@k8s-master helm]# cp -a linux-amd64/helm /usr/local/bin
[root@k8s-master helm]# cd /usr/local/bin/
[root@k8s-master bin]#  chmod a+x helm
[root@k8s-master bin]# helm init --service-account tiller --skip-refresh
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.

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
[root@k8s-master bin]#


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM